[Zope3-checkins] CVS: zopeproducts/xmldom - core.py:1.7 xmlextended.py:1.2

Philipp von Weitershausen philikon@philikon.de
Thu, 19 Jun 2003 14:56:51 -0400


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

Modified Files:
	core.py xmlextended.py 
Log Message:
Defined interfaces for DOM Core and XML Extended. The interfaces are based
upon the current working draft for DOM Level 3, which is available at
http://www.w3.org/TR/DOM-Level-3-Core/core.html. This doesn't mean, though,
that we are implementing DOM Level 3 yet.


=== zopeproducts/xmldom/core.py 1.6 => 1.7 ===
--- zopeproducts/xmldom/core.py:1.6	Sat Jun 14 08:59:18 2003
+++ zopeproducts/xmldom/core.py	Thu Jun 19 14:56:20 2003
@@ -17,12 +17,17 @@
 import string
 import xml.dom
 
+from zope.interface import implements
 from zope.context import ContextProperty, ContainmentIterator
 from zope.context import ContextAwareDescriptors
 from zope.context import getWrapperContext, getWrapperContainer, getbaseobject
 from zope.context.wrapper import setcontext
 from zope.app.context import ContextWrapper
 
+from interfaces.core import IDOMImplementation, INode, IDocument, \
+     IDocumentFragment, INodeList, INamedNodeMap, ICharacterData, \
+     IAttr, IElement, IText, IComment
+
 # legal qualified name pattern, from PyXML xml/dom/Document.py
 # see http://www.w3.org/TR/REC-xml-names/#NT-QName
 # we don't enforce namespace usage if using namespaces, which basically
@@ -139,6 +144,7 @@
 
 
 class DOMImplementation:
+    implements(IDOMImplementation)
     ContextAwareDescriptors()
 
     def hasFeature(self, feature, version):
@@ -170,6 +176,7 @@
 theDOMImplementation = DOMImplementation()
 
 class Node:
+    implements(INode)
     ContextAwareDescriptors()
 
     ELEMENT_NODE = 1
@@ -806,6 +813,7 @@
     textContent = DOMProperty(_get_textContent)
 
 class Document(Parentless, TextualContent, Node):
+    implements(IDocument)
     ContextAwareDescriptors()
 
     _nodeName = "#document"
@@ -1162,7 +1170,9 @@
 
 
 class DocumentFragment(Parentless, TextualContent, Node):
+    implements(IDocumentFragment)
     ContextAwareDescriptors()
+
     _nodeName = "#document-fragment"
     _nodeType = Node.DOCUMENT_FRAGMENT_NODE
     _parentNode = None
@@ -1213,7 +1223,9 @@
 # Element _attribute members can be shared with Attr nodes; see comment
 # at the Attr class.
 class Element(TextualContent, Node):
+    implements(IElement)
     ContextAwareDescriptors()
+
     _nodeType = Node.ELEMENT_NODE
 
     _allowed_child_types = (Node.ELEMENT_NODE,
@@ -1556,6 +1568,7 @@
     the document contents.
 
     """
+    implements(INodeList)
     ContextAwareDescriptors()
 
     def __init__(self, parent):
@@ -1626,6 +1639,7 @@
     It cannot be used to mutate the document contents.
 
     """
+    implements(INodeList)
     ContextAwareDescriptors()
 
     def __init__(self, list=None):
@@ -1698,6 +1712,7 @@
 
 
 class CharacterData(Childless, Node):
+    implements(ICharacterData)
     ContextAwareDescriptors()
 
     def __init__(self, data):
@@ -1778,6 +1793,7 @@
 
 
 class Text(CharacterData):
+    implements(IText)
     ContextAwareDescriptors()
 
     _nodeName = "#text"
@@ -1814,6 +1830,7 @@
 
 
 class Comment(CharacterData):
+    implements(IComment)
     ContextAwareDescriptors()
 
     _nodeName = "#comment"
@@ -1832,6 +1849,7 @@
 # for setAttributeNode.  We could stay with the string in many cases at the
 # cost of complexity.
 class Attr(Parentless, Node):
+    implements(IAttr)
     ContextAwareDescriptors()
 
     _nodeType = Node.ATTRIBUTE_NODE
@@ -1990,6 +2008,7 @@
     from a parent.
     Must be subclassed to determine what we're looking for and returning.
     """
+    implements(INamedNodeMap)
     ContextAwareDescriptors()
 
     _readonly = 0


=== zopeproducts/xmldom/xmlextended.py 1.1 => 1.2 ===
--- zopeproducts/xmldom/xmlextended.py:1.1	Sat Jun  7 06:13:50 2003
+++ zopeproducts/xmldom/xmlextended.py	Thu Jun 19 14:56:20 2003
@@ -17,9 +17,15 @@
 from core import DOMProperty
 
 import xml.dom
+from zope.interface import implements
 from zope.app.context import ContextWrapper
 
+from interfaces.xmlextended import ICDATASection, IDocumentType, \
+     INotation, IEntity, IEntityReference, IProcessingInstruction
+
 class CDATASection(core.Text):
+    implements(ICDATASection)
+
     _nodeName = "#cdata-section"
     _nodeType = core.Node.CDATA_SECTION_NODE
 
@@ -41,6 +47,8 @@
     systemId = DOMProperty(_get_systemId)
 
 class Entity(Identified, core.Parentless, core.Node):
+    implements(IEntity)
+
     _nodeType = core.Node.ENTITY_NODE
     _readonly = 1
     _in_tree = 0
@@ -92,6 +100,8 @@
     version = property(_get_version, _set_version)
 
 class EntityReference(core.Node):
+    implements(IEntityReference)
+
     _nodeType = core.Node.ENTITY_REFERENCE_NODE
     _readonly = 1
 
@@ -108,6 +118,8 @@
 
 
 class Notation(Identified, core.Childless, core.Parentless, core.Node):
+    implements(INotation)
+
     _nodeType = core.Node.NOTATION_NODE
     _readonly = 1
 
@@ -129,6 +141,8 @@
 
 
 class ProcessingInstruction(core.Childless, core.Node):
+    implements(IProcessingInstruction)
+
     _nodeType = core.Node.PROCESSING_INSTRUCTION_NODE
 
     def __init__(self, target, data):
@@ -165,6 +179,8 @@
 
 
 class DocumentType(Identified, core.Childless, core.Node):
+    implements(IDocumentType)
+
     _nodeType = core.Node.DOCUMENT_TYPE_NODE
     _nodeValue = None
     _internalSubset = None