-
-
Save jlcampana/5394272 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import "DDXMLNode.h" | |
@interface DDXMLNode (CDATA) | |
/** | |
Creates a new XML element with an inner CDATA block | |
<name><![CDATA[string]]></name> | |
*/ | |
+ (id)cdataElementWithName:(NSString *)name stringValue:(NSString *)string; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "DDXMLNode+CDATA.h" | |
#import "DDXMLElement.h" | |
#import "DDXMLDocument.h" | |
@implementation DDXMLNode (CDATA) | |
+ (id)cdataElementWithName:(NSString *)name stringValue:(NSString *)string | |
{ | |
NSString* nodeString = [NSString stringWithFormat:@"<%@><![CDATA[%@]]></%@>", name, string, name]; | |
DDXMLElement* cdataNode = [[DDXMLDocument alloc] initWithXMLString:nodeString | |
options:DDXMLDocumentXMLKind | |
error:nil].rootElement; | |
return [cdataNode copy]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment