[xml] Q: how to parsing an XML stream by elements...
- From: "lode leroy" <lode_leroy hotmail com>
- To: xml gnome org
- Subject: [xml] Q: how to parsing an XML stream by elements...
- Date: Fri, 11 Jun 2004 12:37:58 +0200
Hi folks,
I would like to parse an XML stream, and get DOM objects for each
second-level node.
<stream>
<element id="1"/>
<name><first>lode</first><last>leroy</last></name>
<addr><street>broadway</street><number>1</number></addr>
<element id="2"/>
<person alias="me">
<name>lode</name>
<children>
<person><name>louis</name></person>
</children>
</person>
</stream>
I would like to process the stream by element, so I would like to receive
element_callback(<element id="1"/>)
element_callback(<name><first>lode</first><last>leroy</last></name>)
element_callback(<addr><street>broadway</street><number>1</number></addr>)
element_callback(<element id="2"/>)
element_callback(
<person alias="me">
<name>lode</name>
<children>
<person><name>louis</name></person>
</children>
</person>
)
Having a look at the API (being new to libxml) I guess I'd best go with the
Reader API.
Now I notice that xmlTextReaderRead() only returns after the next element
has started,
so element_callback(<element id="1"/>) is only called after "<name" has been
seen,
and not as I hoped, after "/>" or "</element>" has been seen
Does anyone know how to get libxml2 to do what I want to accomplish?
-- lode
_________________________________________________________________
MSN Messenger v6.2 al geïnstalleerd?
http://messenger.msn.be?DI=1032&XAPID=2604&SU=hotmail.be
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]