OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [xml-dev] use SAX to get "tree" under XML node

Have you considered using a different type of parser? SAX can be used to remember tree structures but that's really a programmers job to put it in. Its main purpose seems to be better for "blind" read once parsing. You should look into something like the DOM parser. It is more interactive and holds the entire tree structure for you so that you can find any individual subtrees that you need.
-----Original Message-----
From: Will Johnson [mailto:will.johnson@av.com]
Sent: Wednesday, November 14, 2001 2:33 PM
To: xml-dev@lists.xml.org
Subject: [xml-dev] use SAX to get "tree" under XML node

i'm using the Apache SAX parser and i need to get the XML tree underneath a specific node.
for example in the following xml file...
    <field1>value 1</field1>
    <field2><style value="red"/><values>value 2</values></field2>
i want to be able to get the trigger on the element field2 and somehow get back the string
<style value="red"/><value1>value1</value1><value2>value 2</value2></values>
if i use a regular sax processor to get all the characters i end up getting only the text which in this case would be "value 1 value 2"
any way around this?