# HG changeset patch # User paulb # Date 1133402382 0 # Node ID 6b5890399674976e30234ef4ae5438732a89c7d8 # Parent 587985051e3d2101881bfff20e9b25be1202505a [project @ 2005-12-01 01:59:42 by paulb] Updated version number. Added doctype support (dubious in places due to a lack of libxml2mod support/understanding). Removed doctype nodes from childNodes results. diff -r 587985051e3d -r 6b5890399674 libxml2dom/macrolib/__init__.py --- a/libxml2dom/macrolib/__init__.py Thu Dec 01 01:59:06 2005 +0000 +++ b/libxml2dom/macrolib/__init__.py Thu Dec 01 01:59:42 2005 +0000 @@ -2,7 +2,7 @@ "DOM macro library for libxml2." -__version__ = "0.2.4" +__version__ = "0.2.5" # Expose all functions here. diff -r 587985051e3d -r 6b5890399674 libxml2dom/macrolib/macrolib.py --- a/libxml2dom/macrolib/macrolib.py Thu Dec 01 01:59:06 2005 +0000 +++ b/libxml2dom/macrolib/macrolib.py Thu Dec 01 01:59:42 2005 +0000 @@ -62,7 +62,9 @@ child_nodes = [] node = libxml2mod.children(node) while node is not None: - child_nodes.append(node) + # Remove doctypes. + if Node_nodeType(node) != xml.dom.Node.DOCUMENT_TYPE_NODE: + child_nodes.append(node) node = libxml2mod.next(node) return child_nodes @@ -140,6 +142,9 @@ else: return None +def Node_doctype(node): + return libxml2mod.xmlGetIntSubset(node) + def Node_hasAttributeNS(node, ns, localName): return Node_getAttributeNS(node, ns, localName) is not None @@ -331,15 +336,14 @@ # Utility functions. -def createDocumentType(localName, publicId, systemId): - return None - def createDocument(namespaceURI, localName, doctype): # NOTE: Fixed to use version 1.0 only. d = libxml2mod.xmlNewDoc("1.0") if localName is not None: root = Node_createElementNS(d, namespaceURI, localName) Node_appendChild(d, root) + if doctype is not None: + libxml2mod.xmlCreateIntSubset(d, doctype.localName, doctype.publicId, doctype.systemId) return d def parse(stream_or_string, html=0):