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

Seo Sanghyeon sanxiyn at gmail.com
Fri Oct 31 01:05:01 CET 2008


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



More information about the Ironpython-users mailing list