Parsing common elements between xml documents
Parsing common elements between xml documents
- Subject: Parsing common elements between xml documents
- From: Malayil George <email@hidden>
- Date: Sat, 17 Apr 2010 15:42:17 -0400
Hi,
I have an xml document of structure say
<A>
<B>
<C>
.
.
.
</C>
</B>
</A>
Element B can occur in another document
<D>
<B>
<C>
.
.
.
</C>
</B>
</D>
I have been going through NSXMLParser (on the iPhone) and can parse
document A by setting the delegate and implementing the methods. I am going
through the document and setting the values found in the doc in an
equivalent A class object. But, I figure it would be easier if I could set
up a parser that would parse B into it's object and return it. So, while
parsing A, when I encounter element B, I would like to hand-off the entire B
element to my B parser and have it return object B. This way, while parsing
doc D, I could do the same thing (and not have to duplicate code for parsing
B) and my code is more readable. However, I am not able to figure out how to
do that. The only thing I seem to have between startElement and endElement
is foundCharacters and I don't seem to see a straightforward way of pulling
all the elements contained in B (outside of actually going through the B
elements and building a B doc in which case I might as well just parse it
right there).
Any ideas much appreciated.
Thanks
George
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden