1

Possible Duplicate:
Using NSXMLParser with CDATA

Im using NSXMLParser to parse xml data from my server.
when user send a text message to another user my server is using CDATA tag to wrap the user text, because user text can break the xml structure.

My question is will the NSXMLParser know how to handle the CDATA automatically? Is it built in the NSXMLParser mechanism?

Community
  • 1
  • 1
user1590031
  • 308
  • 1
  • 5
  • 15
  • It's worth noting that, even with CDATA, user input can break the XML structure e.g. if you type in `foo bar ]]>` << looks like the end of the CDATA – JeremyP Aug 10 '12 at 12:30

2 Answers2

5

I've never used NSXMLParser, but a quick lookup to the documentation of the NSXMLParserDelegate protocol reveals method parser:foundCDATA:.

Monolo
  • 18,205
  • 17
  • 69
  • 103
Analog File
  • 5,280
  • 20
  • 23
  • Thanks @Monolo, I did not know I could do that. Is that a standard markdown feature? If so I guess I need to brush up my markdown (but do not spill this with Gruber). – Analog File Aug 10 '12 at 12:32
  • TBH, I don't know - but the "local" version is documented here: http://stackoverflow.com/editing-help/ – Monolo Aug 10 '12 at 14:52
  • Oh, thanks again. I had seen that page, but skimmed through only until the point where it linked to Gruber's site for more info. Turns out the non standard additions to markdown are documented past that, right at the end. I should facepalm+RTFM I guess. – Analog File Aug 10 '12 at 15:32
0

Its part of the XML spec so an XML parser has to support it.

deleted_user
  • 3,817
  • 1
  • 18
  • 27