0

i am getting problem while reading xml files through nsxmlparser in ios,

<PRODUCTS>
    <PRODUCTSLIST>
        <PRODUCTDETAILS>
                <headertext> test header </headertext>
                <description><b style="font-size: x-small;">product, advantages</b></description>
        </PRODUCTDETAILS>
    </PRODUCTSLIST>
</PRODUCTS>

while i read the file using nsxmlparser i am able to get value(test header) for headertext but the description attribute value contains html tags so i cant able to get the result (<b style="font-size: x-small;">product, advantages</b>)i am getting result as empty How can i get the result as((<b style="font-size: x-small;">product, advantages</b>)) for description attribute?

2 Answers 2

2

Speaking from a developers perspective I would not recommend using NSXMLParser due to it's laborious way to parse XML Files. There is a great write up about choosing the right XML Parser.

I use KissXML quite often. You can find a quit tutorial of using it here.

Hope this helps.

Sign up to request clarification or add additional context in comments.

4 Comments

that's ok for 'smaller' files. but a DOM parser will eat up a lot of memory btw, kissXML tries to emulate NSXML for mac so you can also read that docs
I used it for files larger than 4000 lines and it worked well. But I only used it to parse the Data and stored it into CoreData.
Reading xml file , i have only maximum 50 records if i use KissXml means it have so many class files and memory...
4000 lines is small.... thats why I said 'small' -- Im using KissXML in a web scraper and it is great but when you have to deal with XMLs that are in the 10 MB+ range..... it might not be a good fit -- oh and it is slow in comparison!
0

Your problem is that the "b" tag is considered part of the XML structure, try escaping the '<' and '>' characters of the 'b' tag:
@"&lt;b style=\"font-size: x-small;&gt;product, advantages&lt;/b&gt;"
see here

1 Comment

that description attribute comming from service so that column having dynamic values .... if bold we can try like this suppose font and other tag came means how can i manage that ..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.