You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by pe...@apache.org on 2013/07/29 11:44:08 UTC

svn commit: r1507988 - /chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m

Author: peberlein
Date: Mon Jul 29 09:44:08 2013
New Revision: 1507988

URL: http://svn.apache.org/r1507988
Log:
Patch from Mike Hatfield to fix a malformed <title> element during update

Modified:
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m?rev=1507988&r1=1507987&r2=1507988&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryWriter.m Mon Jul 29 09:44:08 2013
@@ -70,12 +70,21 @@
 
 - (NSString *)xmlStartElement
 {
-    return [NSString stringWithFormat:
-                                   @"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-                                   "<entry xmlns=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\" xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\"  >"
-                                   "<id>urn:uuid:00000000-0000-0000-0000-00000000000</id>"
-                                   "<title>%@</title>",
-                                   [self.cmisProperties propertyValueForId:kCMISPropertyName]];
+    NSString *startElement = @"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+                            "<entry xmlns=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\" xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\"  >"
+                            "<id>urn:uuid:00000000-0000-0000-0000-00000000000</id>";
+    NSString *namePropertyValue = [self.cmisProperties propertyValueForId:kCMISPropertyName];
+    
+    // Determine format of title element depending on nil status of namePropertyValue
+    if (nil != namePropertyValue)
+    {
+        startElement = [startElement stringByAppendingFormat:@"<title>%@</title>", namePropertyValue];
+    }
+    else
+    {
+        startElement = [startElement stringByAppendingString:@"<title/>"];
+    }
+    return startElement;
 }
 
 - (NSString *)xmlContentStartElement