Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

SAX Parser

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

I am using SAX Parser to parse a file content as Follows.

<O N="solution" T="solution" ID="tr_2">
<O N="statements" T="statements">
<O N="statement" T="statement">
<V N="statement text">Preparing a glass</V>
<V N="role">goal</V>
<V N="truth">true</V>
<V N="acl">open</V>
</O>
<O N="statement" T="statement">
<V N="statement text">CGD</V>
<V N="role">fact</V>
<V N="truth">true</V>
<V N="acl">open</V>
</O>
</O>
I have <O> within a <O> and how do i know that the current end element </0> is corresponding the respective <0> start element. I'm using XERCES parser .

Please let me know.

Thanks
Gandhi
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The SAX parser (and any XML) kinda follows the FILO paradigm.
Meaning First In Last Out.
So the /O is always closing the immediately preceeding
O element.

Does that help ?

- m
 
Gandhi Subramanian
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SAX parsing is Sequential of element tags.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In case you are asking -

Originally posted by Gandhi Subramanian:
SAX parsing is Sequential of element tags ?



Yes, SAX is a sequential parser.

- m
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Gandhi Subramanian:
...
I have <O> within a <O> and how do i know that the current end element </0> is corresponding the respective <0> start element. I'm using XERCES parser .

Please let me know.

Thanks
Gandhi[/QB]



YOU keep track of what tags are open with a stack.
 
mooooooo ..... tiny ad ....
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic