From: kaklis on
Hi there,
i'm writing a console app using the cmd library. I also use
xml.dom.minidom to parse an xml file that i get as a response to an
HTTP Post request.
with
data = response.read()
i get the xml response from the server.
i then feed the parser with that data.
myDoc = parse(data)
but it doesn't work.
To make it work i open an xml file and the save the data to that file.
myDoc = parse('test.xml')
that worked.
But i don't want to use the local xml file?
What am i doing wrong?

Thanks in advance
A.
From: Stefan Behnel on
kaklis(a)gmail.com, 14.05.2010 12:46:
> Hi there,
> i'm writing a console app using the cmd library. I also use
> xml.dom.minidom to parse an xml file that i get as a response to an
> HTTP Post request.
> with
> data = response.read()
> i get the xml response from the server.
> i then feed the parser with that data.
> myDoc = parse(data)
> but it doesn't work.

Note that "it doesn't work" is not a very complete description of the
actual problem.


> To make it work i open an xml file and the save the data to that file.
> myDoc = parse('test.xml')
> that worked.
> But i don't want to use the local xml file?
> What am i doing wrong?

Not reading the docs?

http://docs.python.org/library/xml.dom.minidom.html

There is a parseString() function that does what you want.

Stefan

From: kaklis on
On May 14, 7:10 am, Stefan Behnel <stefan...(a)behnel.de> wrote:
> kak...(a)gmail.com, 14.05.2010 12:46:
>
> > Hi there,
> > i'm writing a console app using the cmd library. I also use
> > xml.dom.minidom to parse an xml file that i get as a response to an
> > HTTP Post request.
> > with
> > data = response.read()
> > i get the xml response from the server.
> > i then feed the parser with that data.
> > myDoc = parse(data)
> > but it doesn't work.
>
> Note that "it doesn't work" is not a very complete description of the
> actual problem.
>
> > To make it work i open an xml file and the save the data to that file.
> > myDoc = parse('test.xml')
> > that worked.
> > But i don't want to use the local xml file?
> > What am i doing wrong?
>
> Not reading the docs?
>
> http://docs.python.org/library/xml.dom.minidom.html
>
> There is a parseString() function that does what you want.
>
> Stefan

ok, i missed that function.
Thank you so much!!
Antonis