[XML-SIG] binding an unbound namespace prefix

Fred L. Drake, Jr. fdrake at acm.org
Tue Dec 23 08:35:05 EST 2003


Keith Beattie writes:
 > I'm trying to parse a string which is a segment of xml (in order to
 > canonicalize it) which doesn't have all it's namespaces bound in
 > the segment I'm trying to parse.  How do I pass the namespaces into
 > minidom.parseString(), or
 > Domlette.NonvalidatingReader.parseString(),such that they'll be
 > happy with the 'unbound prefix'?  I hoped to see an nsdict kw arg
 > or some such, but no luck.  Is building the dom myself the only way
 > to do this?

No, but working around the current API to do this is pretty painful at
the moment.  Please file a feature request for better fragment
support; you can assign it to me if you like.

There is some code in xml.dom.expatbuilder that shows how to do this;
it may be a bit difficult to decipher.  The code is mine, so feel free
to ask questions about it here on the XML-SIG mailing list.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation



More information about the XML-SIG mailing list