• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Parsing common elements between xml documents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Parsing common elements between xml documents
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Strange "autoreleased with no pool in place" message
  • Next by Date: Re: method caller mixup
  • Previous by thread: Re: Strange "autoreleased with no pool in place" message
  • Next by thread: Re: Parsing common elements between xml documents
  • Index(es):
    • Date
    • Thread