Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Problem escaping quotes in XML file

McKrackenMcKracken Posts: 40Registered Users
edited January 2009 in iPhone SDK Development
Hi!! I've a problem escaping the single and double quotes in an XML string. I have a xml like this:

<xml>
<contact>
<message msg='this is my message with a ' inside or a " '>
</contact>
</xml>

then, when i pass this xml to the parser, the msg value is just - this is my message with a - . If i try to escape manually the ' or " with a \, it doesn't seems to change. What have i to do?

Thank you
Post edited by McKracken on

Replies

  • mpramodjainmpramodjain Posts: 362Registered Users
    edited January 2009
    McKracken wrote: »
    Hi!! I've a problem escaping the single and double quotes in an XML string. I have a xml like this:

    <xml>
    <contact>
    <message msg='this is my message with a ' inside or a " '>
    </contact>
    </xml>

    then, when i pass this xml to the parser, the msg value is just - this is my message with a - . If i try to escape manually the ' or " with a \, it doesn't seems to change. What have i to do?

    Thank you
    HI,
    U can use CDATA concept of the xml. and while parsing using NSXMLParser, u can retrieve them in the FOUNDCDATA callback...
  • BuckyBucky Posts: 356Registered Users
    edited January 2009
    The XML file format is not like PHP. You cannot replace " with ' .

    Quotation marks can be used, but you have to replace the quotation mark with """ (without the quotation marks). As far as I know NSXMLParser will give you the correct string with the """ values replaced by quotation marks
Sign In or Register to comment.