Reading XML namespaces

Martin v. Loewis martin at v.loewis.de
Sun May 16 05:05:51 EDT 2010


> Maybe true technically, but false in practice.  If I receive XML data
> from source XYZ or service XYZ the use of namespaces and their prefixes
> is extremely consistent [in practice] and very customary (for example:
> I've never seen the DSML namespace abbreviated as anything other than
> "dsml" and I rarely see WebDAV propfind XML use a namespace prefix other
> than "D").  The odds that a customer or vendors ERP will generate
> different namespaces and abbreviations between requests is ludicrously
> remote [I don't recall ever seeing it happen].

In that case, you could also hard-code all prefixes in your application;
no need to traverse the input document.

Regards,
Martin



More information about the Python-list mailing list