Re: lxml namespace as an attribute

2018-08-17 Thread Stefan Behnel
Skip Montanaro schrieb am 15.08.2018 um 23:25: > Much of XML makes no sense to me. Namespaces are one thing. If I'm > parsing a document where namespaces are defined at the top level, then > adding namespaces=root.nsmap works when calling the xpath method. I > more-or-less get that. > > What I

Re: lxml namespace as an attribute

2018-08-16 Thread Skip Montanaro
> You seem to think that you need to take the namespace definitions > from the XML document itself. This is not the case: you can > provide them from whatever soure you want. I was under the impression that XML was a self-describing format. I've been disabused of that notion. Skip --

Re: lxml namespace as an attribute

2018-08-15 Thread dieter
Skip Montanaro writes: > Much of XML makes no sense to me. Namespaces are one thing. If I'm > parsing a document where namespaces are defined at the top level, then > adding namespaces=root.nsmap works when calling the xpath method. I > more-or-less get that. > > What I don't understand is how

Re: lxml namespace as an attribute

2018-08-15 Thread Skip Montanaro
> See https://lxml.de/tutorial.html#namespaces and > https://lxml.de/2.1/FAQ.html#how-can-i-specify-a-default-namespace-for-xpath-expressions > for direction. I had read at least the namespaces section of the tutorial. I could see the namespace definition right there in the XML and figured

RE: lxml namespace as an attribute

2018-08-15 Thread Joseph L. Casale
-Original Message- From: Python-list On Behalf Of Skip Montanaro Sent: Wednesday, August 15, 2018 3:26 PM To: Python Subject: lxml namespace as an attribute > Much of XML makes no sense to me. Namespaces are one thing. If I'm > parsing a document where namespaces are defined at t

Re: lxml namespace as an attribute

2018-08-15 Thread Skip Montanaro
Ack. Of course I meant the subject to be "XML namespace as an attribute". I happen to be using lxml.etree. (Long day, I guess...) S On Wed, Aug 15, 2018 at 4:25 PM Skip Montanaro wrote: > > Much of XML makes no sense to me. Namespaces are one thing. If I'm > parsing a document where namespaces

lxml namespace as an attribute

2018-08-15 Thread Skip Montanaro
Much of XML makes no sense to me. Namespaces are one thing. If I'm parsing a document where namespaces are defined at the top level, then adding namespaces=root.nsmap works when calling the xpath method. I more-or-less get that. What I don't understand is how I'm supposed to search for a tag when