• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSXMLDocument question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >NSXMLDocument question (From: malcom <email@hidden>)
 >Re: NSXMLDocument question (From: Ilan Volow <email@hidden>)
 >Re: NSXMLDocument question (From: Robert Walker <email@hidden>)
 >Re: NSXMLDocument question (From: John Stiles <email@hidden>)
 >Re: NSXMLDocument question (From: malcom <email@hidden>)
 >Re: NSXMLDocument question (From: John Stiles <email@hidden>)
 >Re: NSXMLDocument question (From: malcom <email@hidden>)
 >Re: NSXMLDocument question (From: Sarah Wilkin <email@hidden>)
 >Re: NSXMLDocument question (From: malcom <email@hidden>)

  • Prev by Date: Re: Plus and minus images
  • Next by Date: Re: [ANN]: HDCrashReporter
  • Previous by thread: Re: NSXMLDocument question
  • Next by thread: Resizable inline images in NSTextView
  • Index(es):
    • Date
    • Thread