parse xml

Nitin Pawar nitinpawar432 at gmail.com
Fri Oct 15 14:45:05 EDT 2010


this is wrong xml.dom.minidom.parseString("boolean_width.xml") ... if u r
parsing from String use string variable as argument or use parse only if
parsing from file

On Sat, Oct 16, 2010 at 12:07 AM, Andreas Waldenburger
<usenot at geekmail.invalid> wrote:

> On Fri, 15 Oct 2010 10:49:18 -0700 (PDT) kostia
> <kostya.demchuk at gmail.com> wrote:
>
> > I have xml file:
> > <?xml version="1.1" encoding="UTF-8"?>
> > <root>
> >         <n>50000</n>
> > </root>
> >
> > I want to get the value of n (= 50000) inside my python program, I'm
> > doing this:
> >
> > import xml.dom.minidom
> > from xml.dom.minidom import Node
> > doc = xml.dom.minidom.parseString("boolean_width.xml")
> > n = doc.getElementsByTagName("root")[0].firstChild.nodeValue.strip()
> > print n
> >
> > and it is failed. [snip]
>
> How? What's the error message?
>
> --
> To reach me via email, replace INVALID with the country code of my home
> country.  But if you spam me, I'll be one sour Kraut.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Nitin Pawar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101016/812c5c6b/attachment.html>


More information about the Python-list mailing list