Reading XML namespaces

Martin v. Loewis martin at v.loewis.de
Sat May 15 20:37:33 EDT 2010


> ???  The namespaces are embedded in the document.  Personally I find it
> odd I have to tell xpath about the namespace of the document it is a
> $*&@(*& method of.

How so? Why do you say it's a "method", and why do you say "of"?

Usually, xpath expressions are *not* part of the document they operate
on, but part of the code that performs the operation. Consequentially,
the namespace prefixes in the xpath expression do *not* occur in the
document (other than by chance), but are defined by whoever writes the
xpath expression. That is typically somebody different from the one
writing the document - if you would always write them together, you
wouldn't need xpath in the first place, but could produce the selection
result right away.

Regards.
Martin



More information about the Python-list mailing list