[IronPython] An issue with using System.Xml as a Python DOM implementation

Curt Hagenlocher curt at hagenlocher.org
Fri Oct 31 02:01:51 CET 2008


It's not reasonable to view the specification as prescribing syntax; what it
specifies are the *semantics* of the DOM, and naturally, different languages
and environments will implement these semantics differently.

Presumably, NodeType wasn't described as an enumeration in the document
because neither IDL nor Java supported enumerations at the time.


My question is, why does the answer matter?

On Thu, Oct 30, 2008 at 5:05 PM, Seo Sanghyeon <sanxiyn at gmail.com> wrote:

> I am not sure to whom this mail should be addressed. Please help if you
> know.
>
> I am considering the idea of using System.Xml as a Python DOM
> implementation again. After some experimentation, one issue is this:
> an idiomatic way to check for the type of DOM node in Python is:
>
> if node.nodeType == node.ELEMENT_NODE:
>
> nodeType is spelled NodeType with capital N in .NET, but that's fine.
> I can translate naming convention. The problem is that .NET's XmlNode
> type does not have attributes for DOM node types, that is,
> ELEMENT_NODE, ATTRIBUTE_NODE, etc. Instead, these attributes ara
> available under XmlNodeType enumeration, with wholly different names,
> like Element, Attribute, etc.
>
> My question is, why is this blatant incompatibility?
>
> DOM level 1 Core standard
> http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html
>
> seems to clearly say that Node interface should have constants like
> ELEMENT_NODE, ATTRIBUTE_NODE, etc. defined.
>
> --
> Seo Sanghyeon
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20081030/fb0ab499/attachment.html>


More information about the Ironpython-users mailing list