Re: XML parser: Element ordering?

2012-08-31 Thread Dave Angel
On 08/31/2012 08:21 AM, Stefan Behnel wrote: > Florian Lindner, 31.08.2012 14:03: >> I plan to use the etree.ElementTree XML parser to parse a config file >> in which the order of the elements matter, e.g.: >> >> >> >> >> >> is not equal to: >> >> >> >> >> >> I have found different answers to

Re: XML parser: Element ordering?

2012-08-31 Thread Stefan Behnel
Florian Lindner, 31.08.2012 14:03: > I plan to use the etree.ElementTree XML parser to parse a config file > in which the order of the elements matter, e.g.: > > > > > > is not equal to: > > > > > > I have found different answers to the question if order matters in XML > documents. So my

Re: XML parser

2008-10-20 Thread Diez B. Roggisch
RC wrote: > By default the > > document = xml.dom.minidom.parse(inputFileName.xml) > > This will convert all the & to & > But I want to convert the & back to & > > Is there a module or method in Python? > I know there is such method in PHP, but I am > new in Python. >>> from xml.sax import sax

RE: Xml parser

2007-05-27 Thread Eiwot
Let's try http://pyxml.sourceforge.net/ Cheers Python Articles at http://pyarticles.blogspot.com/> Date: Sat, 26 May 2007 10:02:06 +0200> From: [EMAIL PROTECTED]> Subject: Re: Xml parser> To: python-list@python.org> > XiaQ wrote:> > You can use DOM> > ht

Re: Xml parser

2007-05-26 Thread Stefan Behnel
XiaQ wrote: > You can use DOM > http://diveintopython.org/, Chapter 9 > "ashish" wrote >> Hi All, >> >> I want to know weather is there any api available in python for parsing >> xml(XML parser) >> >> Regards >> Ashish Sure, you can use DOM, but if you want to get real work done with XML, lxml is

Re: Xml parser

2007-05-26 Thread XiaQ
You can use DOM http://diveintopython.org/, Chapter 9 "ashish" wrote > Hi All, > > I want to know weather is there any api available in python for parsing > xml(XML parser) > > Regards > Ashish > -- http://mail.python.org/mailman/listinfo/python-list

Re: Xml parser

2007-05-25 Thread kyosohma
On May 25, 7:04 am, "Amit Khemka" <[EMAIL PROTECTED]> wrote: > On 5/24/07, ashish <[EMAIL PROTECTED]> wrote: > > > Hi All, > > > I want to know weather is there any api available in python for parsing > > xml(XML parser) > > Checkout cElementTree . > > Cheers, > > -- > > Amit Khemka -- onyomo.

Re: Xml parser

2007-05-25 Thread Amit Khemka
On 5/24/07, ashish <[EMAIL PROTECTED]> wrote: > Hi All, > > I want to know weather is there any api available in python for parsing > xml(XML parser) Checkout cElementTree . Cheers, -- Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endless th

Re: Xml parser

2007-05-25 Thread Max M
ashish skrev: > Hi All, > > I want to know weather is there any api available in python for parsing > xml(XML parser) I have had very good succes with lxml -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: XML parser that sorts elements?

2006-09-28 Thread jmike
Paul McGuire wrote: > >>> doc.childNodes[0].childNodes = sorted( > ... [n for n in doc.childNodes[0].childNodes > ... if n.nodeType==doc.ELEMENT_NODE], > ... key=lambda n:n.nodeName) > >>> print doc.toprettyxml() > > > > goodbye > > >

Re: XML parser that sorts elements?

2006-09-22 Thread Paul McGuire
"Paul McGuire" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > This is what I posted, but it's not what I typed. I entered some very long lines at the console, and the newsgroup software, when wrapping the text, pre

Re: XML parser that sorts elements?

2006-09-22 Thread jmike
Paul McGuire wrote: ... > Here is a snippet from an interactive Python session, working with the > "batteries included" xml.dom.minidom. The solution is not necessarily in > the parser, it may be instead in what you do with the parsed document > object. > > This is not a solution to your actual

Re: XML parser that sorts elements?

2006-09-22 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi everyone, > > I am a total newbie to XML parsing. I've written a couple of toy > examples under the instruction of tutorials available on the web. > > The problem I want to solve is this. I have an XML snippet (in a > string) that

Re: XML parser that sorts elements?

2006-09-22 Thread jmike
Diez B. Roggisch wrote: > You can sort them by obtaining them as tree of nodes, e.g. using element > tree or minidom. > > But you should be aware that this will change the structure of your document > and it isn't always desirable to do so - e.g. html pages would look funny > to say the least if

Re: XML parser that sorts elements?

2006-09-22 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi everyone, > > I am a total newbie to XML parsing. I've written a couple of toy > examples under the instruction of tutorials available on the web. > > The problem I want to solve is this. I have an XML snippet (in a > string) that looks like this: > > > hello