[Zope3-checkins] CVS: zopeproducts/xml - content.py:1.1 configure.zcml:1.3 domdocument.py:NONE

Philipp von Weitershausen philikon@philikon.de
Sun, 22 Jun 2003 20:26:11 -0400


Update of /cvs-repository/zopeproducts/xml
In directory cvs.zope.org:/tmp/cvs-serv20780

Modified Files:
	configure.zcml 
Added Files:
	content.py 
Removed Files:
	domdocument.py 
Log Message:
* Renamed domdocument module to content and added a generic implementation
  of IXMLText (taken from the xslt subpackage).

* Changed DOMDocumentFactory to use an adapter.

* Updated configuration accordingly.


=== Added File zopeproducts/xml/content.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
DOM Document

$Id: content.py,v 1.1 2003/06/23 00:26:11 philikon Exp $
"""

from StringIO import StringIO

from zope.interface import implements
from zope.component.interfaces import IFactory
from zope.app import zapi
from zope.app.interfaces.xml.source import IXMLText
from zope.app.xml.w3cschemalocations import \
     setInstanceInterfacesForXMLText

from zopeproducts.xml.interfaces.dom.core import IDocument
from zopeproducts.xml.dom import expatbuilder

class XMLText:
    implements(IXMLText)

    def __init__(self, xml="<doc/>"):
        self.source = xml
        setInstanceInterfacesForXMLText(self)

class DOMDocumentFactory:
    implements(IFactory)

    def getInterfaces(self):
        return (IDocument,)

    def __call__(self, xml='<doc/>'):
        xmltext = XMLText(xml)
        return zapi.getAdapter(xmltext, IDocument)

domDocumentFactory = DOMDocumentFactory()


=== zopeproducts/xml/configure.zcml 1.2 => 1.3 ===
--- zopeproducts/xml/configure.zcml:1.2	Fri Jun 20 18:16:48 2003
+++ zopeproducts/xml/configure.zcml	Sun Jun 22 20:26:11 2003
@@ -1,14 +1,16 @@
-<zopeConfigure
-   xmlns="http://namespaces.zope.org/zope"
-   xmlns:browser="http://namespaces.zope.org/browser">
+<zopeConfigure xmlns="http://namespaces.zope.org/zope">
 
-<!-- DOM Document directives -->
+<!-- include sub-packages -->
 
-<content class="zopeproducts.xml.dom.core.Document">
-  <require
-    permission="zope.ManageContent"
-    interface="zopeproducts.xml.interfaces.dom.core.IDocument" />
+<include package=".dom" />
+
+<include package=".browser" />
+
+
+<!-- DOM Document directives -->
 
+<!-- allow Zope to attach annotations to DOM Document -->
+<content class=".dom.core.Document">
   <implements
     interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
 </content>
@@ -16,16 +18,10 @@
 <!-- We need to provide our own factory for DOM Document because
      we cannot instanciate a DOM node ourselves. Instead, we have
      to use one of the builders -->
-
 <factory
   id="DOMDocument"
-  component=".domdocument.domDocumentFactory"
+  component=".content.domDocumentFactory"
   permission="zope.ManageContent" />
-
-
-<!-- include sub-packages -->
-
-<include package=".browser" />
 
 
 <!-- remove the comments to enable the XSLT package -->

=== Removed File zopeproducts/xml/domdocument.py ===