Martin v. Loewis, 16.05.2010 11:05:
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.
+1. Hard-coding the prefixes is the best way to make the interface of your
code consistent and predictable.
Stefan
--
http://mail.python.org/mailman/listinfo/python-list