build a hierarchical tree, without using DOM,schema, and sax usingexpat parser and c

S

sharan

I've been experimenting with the jclark's expat parser. I compiled it
on
linux, and it works just great. However, finding tags and data by
implementing the callback functions in c language is cumbersome.
Has anybody written code that uses the expat callback's in such a way
as to
build a hierarchical tree, without using DOM,schema, and sax, that can
be traversed.My purpose, just enough to traverse branches and find
leafs of a xml documents without using DOM, schema, and sax, and i
also want help regarding how to convert a xml document to a
hierachical tree which contains tags values. thanks
 
W

Wildemar Wildenburger

sharan said:
I've been experimenting with the jclark's expat parser. I compiled it
on
linux, and it works just great. However, finding tags and data by
implementing the callback functions in c language is cumbersome.
Has anybody written code that uses the expat callback's in such a way
as to
build a hierarchical tree, without using DOM,schema, and sax, that can
be traversed.My purpose, just enough to traverse branches and find
leafs of a xml documents without using DOM, schema, and sax, and i
also want help regarding how to convert a xml document to a
hierachical tree which contains tags values. thanks

Not sure if I completely follow you. Maybe ElementTree could be of help?

<URL:http://effbot.org/zone/element-index.htm>

since Python 2.5 it is even in the standard lib:

<URL:http://docs.python.org/lib/module-xml.etree.ElementTree.html>

/W
 
S

Stefan Behnel

Wildemar said:
Not sure if I completely follow you. Maybe ElementTree could be of help?

Just a quick note that it actually uses expat for parsing, so there's no need
to fiddle with it on your own - especially since it's pretty hard to get any
faster than the C implementation of ET, cElementTree, is already...

Stefan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top