[XML-SIG] [ pyxml-Bugs-1110409 ] xmlns attribute not output for
docs from impl.createdocument
SourceForge.net
noreply at sourceforge.net
Thu Jan 27 04:23:50 CET 2005
Bugs item #1110409, was opened at 2005-01-27 11:23
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=106473&aid=1110409&group_id=6473
Category: DOM
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Greg Wogan-Browne (wogan)
Assigned to: Nobody/Anonymous (nobody)
Summary: xmlns attribute not output for docs from impl.createdocument
Initial Comment:
I am having some trouble figuring out what is going on
here - is this a bug, or correct behaviour? Basically,
when I create an XML document with a namespace using
xml.dom.minidom.parse() or parseString(), the namespace
exists as an xmlns attribute in the DOM (fair enough,
as it's in the original source document). However, if I
use the DOM implementation to create an identical
document with a namespace, the xmlns attribute is not
present.
This mainly affects me when I go to print out the
document again using Document.toxml(), as the xmlns
attribute is not printed for documents I create
dynamically, and therefore XSLT does not kick in (I'm
using an external processor).
Python 2.3.3 (#1, May 7 2004, 10:31:40)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import xml.dom.minidom
>>> raw = '<test xmlns="http://example.com/namespace"/>'
>>> doc = xml.dom.minidom.parseString(raw)
>>> print doc.documentElement.namespaceURI
http://example.com/namespace
>>> print doc.documentElement.getAttribute('xmlns')
http://example.com/namespace
>>> impl = xml.dom.minidom.getDOMImplementation()
>>> doc2 =
impl.createDocument('http://example.com/namespace','test',None)
>>> print doc2.documentElement.namespaceURI
http://example.com/namespace
>>> print doc2.documentElement.getAttribute('xmlns')
>>>
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=106473&aid=1110409&group_id=6473
More information about the XML-SIG
mailing list