Re: NSXMLDocument question
Re: NSXMLDocument question
- Subject: Re: NSXMLDocument question
- From: Sarah Wilkin <email@hidden>
- Date: Wed, 8 Mar 2006 08:35:48 -0800
The reason your "<" won't be escaped using this code is that you're
using the option "NSXMLNodePreserveAll". That will be definition
preserve any entities you input as output. As a side note, you should
also use the minimum amount of fidelity options needed when parsing
and creating XML for maximum performance.
--Sarah
On Mar 4, 2006, at 8:29 AM, malcom wrote:
Thank you Sarah,
Ok it now works but there is a problem when XML classes try to
encapsulate an NSString. < chars will be not converted automatically
and it still remain < so the final html string does not well rendered
by WebKit.
This is a short part of my code. Is there another way to convert
automatically <? Or need I do to it with replace functions of
NSString?
NSXMLElement *node = [[NSXMLElement alloc]
initWithKind:NSXMLElementKind options: NSXMLNodePreserveAll];
[node setName:@"TEXT"];
// VALUE & QUOTE
NSXMLElement *valueNode = [[NSXMLElement alloc]
initWithKind:
NSXMLElementKind options:NSXMLNodePreserveAll];
[valueNode setName: @"VALUE"];
[valueNode setStringValue: [[_text objectAtIndex:k]
getText]];
NSXMLElement *quoteNode = [[NSXMLElement alloc]
initWithKind:
NSXMLElementKind options:NSXMLNodePreserveAll];
[quoteNode setName: @"QUOTE"];
[quoteNode setStringValue: [NSString
stringWithFormat:@"%d", [[_text
objectAtIndex:k] state]]];
[node addChild: valueNode];
[node addChild: quoteNode];
[rootText addChild: node];
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden