[Zope3-checkins] CVS: zopeproducts/xmldom - core.py:1.10 traversal.py:1.3

Philipp von Weitershausen philikon@philikon.de
Thu, 19 Jun 2003 19:22:17 -0400


Update of /cvs-repository/zopeproducts/xmldom
In directory cvs.zope.org:/tmp/cvs-serv31209

Modified Files:
	core.py traversal.py 
Log Message:
Added interface for the DOM Level 2 Traversal feature. See
http://www.w3.org/TR/DOM-Level-2-Traversal-Range/traversal.html
for more information.


=== zopeproducts/xmldom/core.py 1.9 => 1.10 ===
--- zopeproducts/xmldom/core.py:1.9	Thu Jun 19 17:38:45 2003
+++ zopeproducts/xmldom/core.py	Thu Jun 19 19:21:46 2003
@@ -34,6 +34,7 @@
 from interfaces.core import IDOMImplementation, INode, IDocument, \
      IDocumentFragment, INodeList, INamedNodeMap, ICharacterData, \
      IAttr, IElement, IText, IComment
+from interfaces.traversal import IDocumentTraversal
 
 # legal qualified name pattern, from PyXML xml/dom/Document.py
 # see http://www.w3.org/TR/REC-xml-names/#NT-QName
@@ -820,7 +821,7 @@
     textContent = DOMProperty(_get_textContent)
 
 class Document(Parentless, TextualContent, Node):
-    implements(IDocument)
+    implements(IDocument, IDocumentTraversal)
     ContextAwareDescriptors()
 
     _nodeName = "#document"
@@ -1086,7 +1087,11 @@
         raise xml.dom.NotSupportedErr(
             "can't import from a different DOM implementation")
 
+    #
     # DOM Level 2 Traversal
+    #
+    # implementing interfaces.traversal.IDocumentTraversal
+    #
 
     def createNodeIterator(self, root, whatToShow, filter,
                            entityReferenceExpansion):


=== zopeproducts/xmldom/traversal.py 1.2 => 1.3 ===
--- zopeproducts/xmldom/traversal.py:1.2	Thu Jun 19 17:38:45 2003
+++ zopeproducts/xmldom/traversal.py	Thu Jun 19 19:21:46 2003
@@ -12,7 +12,7 @@
 #
 ##############################################################################
 """
-XML DOM Impelmentation
+XML DOM Implementation
 
 DOM Level 2 Traversal, based on the W3C recommendation at:
     http://www.w3.org/TR/DOM-Level-2-Traversal-Range/
@@ -26,7 +26,9 @@
 #   iterated, and move over that, only updating on mutation
 
 import xml.dom
+from zope.interface import implements
 
+from interfaces.traversal import INodeFilter, INodeIterator, ITreeWalker
 
 __all__ = [
     "NodeFilter",
@@ -36,6 +38,8 @@
 
 
 class NodeFilter:
+    implements(INodeFilter)
+    
     # Constants returned by acceptNode():
     FILTER_ACCEPT                  = 1
     FILTER_REJECT                  = 2
@@ -237,6 +241,8 @@
 # faster if we kept a list of nodes in document order and updated
 # it when we got a mutation event - once we have mutation events.
 class NodeIterator(AccessorBase):
+    implements(INodeIterator)
+
     BEFORE_NODE = 1 # iterator crossed reference node moving forward
     AFTER_NODE = 0  # iterator crossed reference node moving backward
 
@@ -304,6 +310,8 @@
 
 
 class TreeWalker(AccessorBase):
+    implements(ITreeWalker)
+
     def __init__(self, root, whatToShow=NodeFilter.SHOW_ALL, filter=None,
                  entityReferenceExpansion=1):
         AccessorBase.__init__(self, root, whatToShow,