FromXMLString wanted.

Joonas Paalasmaa joonas.paalasmaa at iki.fi
Sat May 4 16:54:47 EDT 2002


Doru-Catalin Togea wrote:
> 
> > > 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.

You can propably use XMLFromFile with a StringIO.StringIO instance
loaded with the unicode string.

doc = FromXmlFile(StringIO.StringIO(unicodestring))



More information about the Python-list mailing list