How can we can we handle self-closing Tags in NSXmlparser? There is no
starting element and end element — is it possible to handle the following type of Tags?
<ITEM NAME/>
<REG Number/>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Any XML Parser, including NSXMLParser, should be treating this:
identically to this XML:
In other words, as far as the parser code you write is concerned, you should see both the start and the end of the element callbacks being invoked by the parser. To prove this out, I put the following sample XML in a file:
I then implemented the following code to load this file and parse it:
My parser delegate methods were implemented as follows:
When I ran this code I saw the following console output:
As you can see, I got both a didStartElement and didEndElement callback for both the sample1 and sample2 tags, which is how it should be working.