[XML-SIG] Re: DOM creation

Venkatesh Prasad Ranganath rvprasad@cis.ksu.edu
14 Feb 2001 15:00:25 -0600

The following message is a courtesy copy of an article
that has been posted to comp.lang.python as well.

>>>>> "Uche" == Uche Ogbuji <uche@ogbuji.net> writes:

    Uche> Venkatesh Prasad Ranganath wrote:
    >> I have a question on how DOM for a XML document conforming to DOM 2
    >> should be constructed?
    >> Now if there are no namespaces specified in the document then should
    >> attributes be added to DOM using setAttributeNS('', Name, Value) or
    >> setAttribute(Name, Value)?
    >> The problem I am facing is when reading in a XML document with no
    >> explicit namespace specified in it through PyXML the attributes are added
    >> to the DOM using setAttributeNS with an empty NameSpace.  So, I wanted to
    >> clarify if this is a problem with PyXML or is this how other DOM
    >> Constructors work.

    Uche> This is correct behavior.  Of course, if you use the
    Uche> xml.dom.ext.reader.Sax reader, you get a tree with no namespace
    Uche> specifiers at all, which is also correct.

    Uche> If you plan to migrate to namespaces in future, or to mix namespace
    Uche> with non-namespace behavior, I'd suggest sticking to the PyExpat and
    Uche> Sax2 readers and using the DOm Level 2 methods (with appended "NS").

If this is the case then should or shouldn't set/getAttribute() in DOM2
"intelligently" assume empty namespace ('')?  Also, is there any specification
on construction of DOM for XML documents?  Or does the DOM specs available at
W3C describe the construction process?  If so, can somebody tell me in which

    >> waiting for reply,

    Uche> This reminds me.  I'm not sure I sent a reply to your last enquiry.

    Uche> I had a few questions, such as which Reader you were trying to use (It
    Uche> looked as if you didn't paste all of your example code in).

    Uche> However, I'd suggest trying the latest 4Suite 0.10.2 beta that was
    Uche> announced (since I noticed you're using XPath), and see if you still
    Uche> have those problems.  If so, pleace copy follow-ups to
    Uche> xml-sig@python.org, which I check more regularly than this newsgroup.

I guess it works fine on with 0.10.2b.


Venkatesh Prasad Ranganath