PyXML SAX Q?

M

mitsura

Hi,

is it possible to use SAX to parse XML that is not in a file but in a
large string?
If I open my XML file and read the content into a string variable. Is
there a way I can pass it to the PyXML Sax handler?
The reason I want to know is that I need to parse XML that is generated
by a process on a Unix system. I can connect to the process via a
socket and the the XML but I need to store the XML somewhere before I
can parse it.
I could dump it to a file first and then hand it to the parser but that
seems unefficient.

Maybe I could read the XML from the socket directly into the parser.

Any ideas are welcome

With kind regards,

Kris
 
A

Alan Kennedy

[[email protected]]
is it possible to use SAX to parse XML that is not in a file but in a
large string?
If I open my XML file and read the content into a string variable. Is
there a way I can pass it to the PyXML Sax handler?
The reason I want to know is that I need to parse XML that is generated
by a process on a Unix system. I can connect to the process via a
socket and the the XML but I need to store the XML somewhere before I
can parse it.
I could dump it to a file first and then hand it to the parser but that
seems unefficient.

Maybe I could read the XML from the socket directly into the parser.

You can find exactly what you need in this old thread about incremental
XML parsing.

Parsing XML streams
http://groups.google.com/group/comp.lang.python/msg/e97309244914343b?
 

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

Similar Threads

PyXml 4
XML parsing: SAX/expat & yield 2
SAX unicode and ascii parsing problem 4
Using PyXml with Jython 0
DOCTYPE + SAX 2
PyXML: SAX vs. DOM 5
PyXML and Python-2.6 2
XML SAX parser bug? 4

Members online

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,254
Latest member
Top Crypto TwitterChannel

Latest Threads

Top