FromXMLString wanted.

Doru-Catalin Togea doru-cat at ifi.uio.no
Sat May 4 16:14:36 EDT 2002


> > I thought of a hack around it, which would consist of reading in my
> > xml file into a string, replacing non-english characters with their
> > UNICODE encodings and parsing the (xml) string. How do I do that?

> Why don't you just convert the string to unicode bofore feeding it to
> parser.

That's exactly what I intended to do! But what do I do with the string
after encoding it, that is how do I get a DOM tree using a string as an
XML source?

pyxml provides methods like FromXMLStream and FromXMLFile, but no
FromXMLString.

I understand that I can use another package called minidom. I might try
that sometime. From what I found of documentation online I understood
pyxml to be the prefered choice, and I would like to have my scripts which
worked under python 2.0 work with newer releases as well.

As somebody else pointed out to in their response to my original posting,
there might be a bug in pyxml 0.7 for python 2.2. Since nobody seems to
have heard about a FromXMLString method or the equivallent, I downgraded
to python 2.1 and the corresponding pyxml package. To my amazement I found
it to work PARTIALLY! I feed it with the same file which was processed
succesfully by python 2.0 and the corresponding pyxml (about 9 pages of
text within an xml tag) and it crashes! But if I delete most of the text
and feed the parser with only a few sentences, it will parse
successfully! I didn't have the time to investigate further what is going
on.

Superficially considered, it seems that there has been introduced a
"small" bug in pyxml for python 2.1 and a larger one in pyxml for python
2.2 :-)

I am now running python 2.0 and its pyxml module again, and everything is
working fine. For the time being I have no particular need to upgrade to
the latest python release. (when I did upgrade to python 2.2 it was due to
replacing my laptops hardisk with a new one with more storage capacity)

Thanks to every one who replied.
Catalin


	<<<< ================================== >>>>
	<<     We are what we repeatedly do.      >>
	<<  Excellence, therefore, is not an act  >>
	<<             but a habit.               >>
	<<<< ================================== >>>>




More information about the Python-list mailing list