[zopeorg-checkins] CVS: Products/XMLDocument - Builder.py:1.1 CHANGES.txt:1.1 Example.zexp:1.1 Node.py:1.1 README.txt:1.1 XMLDocument.py:1.1 __init__.py:1.1 documentAdd.dtml:1.1 documentEdit.dtml:1.1 documentUpload.dtml:1.1 elementEdit.dtml:1.1 version.txt:1.1 xml_doc.gif:1.1 xml_element.gif:1.1

Sidnei da Silva sidnei at x3ng.com.br
Fri May 30 11:17:58 EDT 2003


Update of /cvs-zopeorg/Products/XMLDocument
In directory cvs.zope.org:/tmp/cvs-serv19195/XMLDocument

Added Files:
	Builder.py CHANGES.txt Example.zexp Node.py README.txt 
	XMLDocument.py __init__.py documentAdd.dtml documentEdit.dtml 
	documentUpload.dtml elementEdit.dtml version.txt xml_doc.gif 
	xml_element.gif 
Log Message:
Adding products needed for migration of NZO

=== Added File Products/XMLDocument/Builder.py ===
##############################################################################
# 
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
# 
# Copyright (c) Digital Creations.  All rights reserved.
# 
# This license has been certified as Open Source(tm).
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions in source code must retain the above copyright
#    notice, this list of conditions, and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions, and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 
# 3. Digital Creations requests that attribution be given to Zope
#    in any manner possible. Zope includes a "Powered by Zope"
#    button that is installed by default. While it is not a license
#    violation to remove this button, it is requested that the
#    attribution remain. A significant investment has been put
#    into Zope, and this effort will continue if the Zope community
#    continues to grow. This is one way to assure that growth.
# 
# 4. All advertising materials and documentation mentioning
#    features derived from or use of this software must display
#    the following acknowledgement:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    In the event that the product being advertised includes an
#    intact Zope distribution (with copyright and license included)
#    then this clause is waived.
# 
# 5. Names associated with Zope or Digital Creations must not be used to
#    endorse or promote products derived from this software without
#    prior written permission from Digital Creations.
# 
# 6. Modified redistributions of any form whatsoever must retain
#    the following acknowledgment:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    Intact (re-)distributions of any official Zope release do not
#    require an external acknowledgement.
# 
# 7. Modifications are encouraged but must be packaged separately as
#    patches to official Zope releases.  Distributions that do not
#    clearly separate the patches from the original work must be clearly
#    labeled as unofficial distributions.  Modifications which do not
#    carry the name Zope may be packaged in any form, as long as they
#    conform to all of the clauses above.
# 
# 
# Disclaimer
# 
#   THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
#   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
#   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
#   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#   SUCH DAMAGE.
# 
# 
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations.  Specific
# attributions are listed in the accompanying credits file.
# 
##############################################################################
"""
XML DOM Builder
"""
from Shared.DC.xml import pyexpat
from OFS import ZDOM
import Globals

class ParseError(Exception): pass

class Builder:
    """
    DOM Builder base class
    
    'nodes' maps Node type codes to classes
    override this class attribute in subclasses
    """
    
    nodes={}
    
    buffer_size=1028 * 32

    def __init__(self):
        self.reset()

    # Public methods
    # --------------
    
    def reset(self, doc=None):
        """
        Reset the builder.
        'doc' is the Document element to root the tree in.
        """
        if doc is None:
            doc=self.nodes[ZDOM.DOCUMENT_NODE]("#document")
        self.cur_elem = self.root = doc
        self.error = None
        self.in_cdata=0

    def parse(self, input):
        """
        Build a DOM tree give a string or a fileobject.
        """
        p = pyexpat.ParserCreate()
        p.StartElementHandler = self.start
        p.EndElementHandler = self.end
        p.CharacterDataHandler = self.cdata
        p.StartCdataSectionHandler = self.start_cdata
        p.EndCdataSectionHandler = self.end_cdata
        p.ProcessingInstructionHandler = self.pi
        p.CommentHandler = self.comment
        p.StartNamespaceDeclHandler = self.start_ns
        p.EndNamespaceDeclHandler = self.end_ns
     
        if type(input)==type(''):
            rv = p.Parse(input, 1)
        else:
            while 1:
                # hmm, this is causing persistence problems, why?
                if Globals.DatabaseVersion == '3':
                   get_transaction().commit(1)
                v=input.read(self.buffer_size)
                if v == "":
                    rv = 1
                    break
                rv = p.Parse(v, 0)
                if not rv:
                    break
        if not rv:
            raise ParseError('%s at line %s' % 
                    (pyexpat.ErrorString(p.ErrorCode), p.ErrorLineNumber))
        else:
            self.root.normalize()
            return self.root
            
    # Handler methods
    # ---------------

    def start(self, name, attrs):
        e=self.nodes[ZDOM.ELEMENT_NODE](name)      
        if self.cur_elem is not None:
            self.cur_elem.appendChild(e)
            self.cur_elem = e.__of__(self.cur_elem)
        else:
            self.cur_elem = self.root = e
        for i in range(0, len(attrs) ,2):
            self.cur_elem.setAttribute(attrs[i], attrs[i+1])
             
    def end(self, name):
        try: self.cur_elem=self.cur_elem.aq_parent      
        except: pass
    
    def cdata(self, data):
        if self.in_cdata:
            e=self.nodes[ZDOM.CDATA_SECTION_NODE](data)
        else:
            e=self.nodes[ZDOM.TEXT_NODE](data)
        self.cur_elem.appendChild(e)
    
    def pi(self, target, data):
        e=self.nodes[ZDOM.PROCESSING_INSTRUCTION_NODE](target, data)
        self.cur_elem.appendChild(e)
    
    def comment(self, data):
        e=self.nodes[ZDOM.COMMENT_NODE](data)
        self.cur_elem.appendChild(e)
    
    def start_cdata(self):
        self.in_cdata=1
        
    def end_cdata(self):
        self.in_cdata=0
    
    def start_ns(self, prefix, uri):
        pass
        
    def end_ns(self, prefix):
        pass
    


=== Added File Products/XMLDocument/CHANGES.txt ===
XML Document Changes

  Version 1.0a2
  
    This version changes quite a bit internally over the last alpha.
    Now XML Document uses ZDOM as much as it can. This will keep us
    all happier and saner. Also this version starts to rely on stuff
    in the latest pyexpat. Finally, the DOM support is much improved.
  
    TODO
  
      * DOM support is still somewhat incomplete and needs massive
      testing. I need to document which DOM methods and nodes are
      supported, and which ones aren't.
  
    Features added

      * Added FTP and PUT support.
        
      * Attributes are now available as Attr Nodes thanks to
      converting to ZDOM.   
    
      * Comment and CDATA Section Nodes are now parsed.

      * Support for DocumentFragment Nodes added.

      * Many more DOM methods implemented.
      
    Bugs Fixed

      * Fixed some DOM modification methods that failed for Nodes
      that don't support children. Thanks to Andrew Kuchling.

      * Fixed getElementsByTagName. Thanks again to Andrew.
    
      * Fixed the return values of some DOM methods. Thanks
      to Martijn Faassen.

      * The clone should work now.

  Version 1.0a1
  
    Initial alpha version


=== Added File Products/XMLDocument/Example.zexp ===
ZEXP       Z      W((U
OFS.FolderqUFolderqtqNt.}q(U	viewSlideq(U       ^q(UOFS.DTMLMethodqU
DTMLMethodqttQUidq	UExampleq
U__ac_local_roles__q}qUamosq
]qUOwnerqasUtreeq(U       _q(UOFS.DTMLDocumentqUDTMLDocumentqttQUSlidesq(U       ’q(U Products.XMLDocument.XMLDocumentqUDocumentqttQU_objectsq(}q(U	meta_typeqUDTML Methodqh	hu}q(U	meta_typeqU
DTML DocumentqUidqUtreeq u}q!(hhhUslideq"u}q#(U	meta_typeq$UXML Documentq%Uidq&USlidesq'u}q((h$h%h&UTreeq)utUTreeq*(U       ›q+(hUDocumentq,ttQUtitleq-UXML Document Examplesq.h"(U       \q/(hUDTMLDocumentq0ttQu.       ^      ¹((UOFS.DTMLMethodqU
DTMLMethodqtqNt.}q(UtitleqU U__name__qU	viewSlideqU__ac_local_roles__q}q	Uamosq
]qUOwnerqasUglobalsq
}qUrawqT  <!--#var standard_html_header-->

<table bgcolor="<!--#var color-->" border="1">
<tr><td>

<H2><!--#var title--></H2>
<p><!--#var "objectValues('body')[0].text_content()" fmt="structured-text"--></p>

</td></tr>
</table>

<!--#if "previousObject('slide')"-->
<a href="<!--#var "previousObject('slide').absolute_url()"-->/viewSlide">&lt;-- previous</a>
<!--#/if-->

<!--#if "nextObject('slide')"-->
<a href="<!--#var "nextObject('slide').absolute_url()"-->/viewSlide">next --&gt;</a>
<!--#/if-->

<!--#var standard_html_footer-->qU_varsq}qu.       _      €((UOFS.DTMLDocumentqUDTMLDocumentqtqNt.}q(UtitleqU
Tree tag demoqUrawqUÌ<!--#var standard_html_header-->
<h2><!--#var title_or_id--></h2>

<p>This tree is created from xml.</p>

<!--#tree expr="Tree[0]"-->
<!--#var getTagName-->
<!--#/tree-->

<!--#var standard_html_footer-->qU__ac_local_roles__q	}q
Uamosq]qUOwnerq
asUglobalsq}qU__name__qUtreeqU_varsq}qu.       ’       Ý((U Products.XMLDocument.XMLDocumentqUDocumentqtqNt.}q(UidqUSlidesqU__ac_local_roles__q}qUamosq	]q
UOwnerqasU
_child_idsq]q
KêaUtitleqU U
_child_mapq}qKê(U     ïq(hUElementqttQsU_next_idqM5u.       ›       Ú((U Products.XMLDocument.XMLDocumentqUDocumentqtqNt.}q(UidqUTreeqU__ac_local_roles__q}qUamosq	]q
UOwnerqasU
_child_idsq]q
KUaUtitleqU U
_child_mapq}qKU(U     ïfq(hUElementqttQsU_next_idqK€u.       \      ¦((UOFS.DTMLDocumentqUDTMLDocumentqtqNt.}q(UtitleqU
Slide demoqU__name__qUslideqU__ac_local_roles__q	}q
Uamosq]qUOwnerq
asUglobalsq}qUrawqUô<!--#var standard_html_header-->
<H2><!--#var title_or_id--></H2>
<ol>
<!--#in "Slides[0].objectValues('slide')"-->
<li><a href="<!--#var absolute_url-->/viewSlide"><!--#var title--></a>
</li>
<!--#/in-->
</ol>

<!--#var standard_html_footer-->qU_varsq}qu.     ï      ÷((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUslidesqUidqUe234qU_idq	KêU
_child_idsq
]q(KëKíMMMM"M2eUcolorqUgrayq
U_propertiesq(}q(UmodeqUwhUtitleqUtypeqUstringqu}q(hUcolorqhhutU
_child_mapq}q(M(U     ï‚q(UProducts.XMLDocument.NodeqUTextqttQM"(U     ïƒq(hUElementqttQM2(U     ï„q(hUTextqttQKí(U     ï…q(hUElementq ttQKë(U     ï†q!(hUTextq"ttQM(U     ï‡q#(hUElementq$ttQM(U     ïˆq%(hUTextq&ttQuu.     ïf      H((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUthingsqUidqUe85qU_idq	KUU
_child_idsq
]q(KVKXKnKqK~eU
_child_mapq}q
(Kn(U     ïgq(UProducts.XMLDocument.NodeqUTextqttQK~(U     ïhq(hUTextqttQKX(U     ïiq(hUElementqttQKV(U     ïjq(hUTextqttQKq(U     ïkq(hUElementqttQuu.     ï‚       ^((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe286qU_idqMU_dataqU
  
  q	u.     ïƒ      ƒ((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUslideqU_propertiesq(}q(Umodeq	UwUidq
UtitleqUtypeqUstringq
u}q(h
Ucolorqhh
uth
Ue290qU_idqM"U
_child_idsq]q(M#M%M0eUcolorqUredqhU
the red slideqU
_child_mapq}q(M%(U     ï‘q(hUElementqttQM#(U     ï’q(UProducts.XMLDocument.NodeqUTextqttQM0(U     ï“q(hUTextqttQuu.     ï„       ]((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe306qU_idqM2U_dataqU   

q	u.     ï…      !((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUslideqUidqUe237qU_idq	KíU
_child_idsq
]q(KîKðM eUtitleqUfirst slideq
U
_child_mapq}q(Kî(U     ïq(UProducts.XMLDocument.NodeqUTextqttQM (U     ïŽq(hUTextqttQKð(U     ïq(hUElementqttQuu.     ï†       Z((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe235qU_idqKëU_dataqU
  q	u.     ï‡      '((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUslideqUidqUe262qU_idq	MU
_child_idsq
]q(MM	MeUtitleqUsecond slideq
U
_child_mapq}q(M(U     ï‰q(UProducts.XMLDocument.NodeqUTextqttQM(U     ïŠq(hUTextqttQM	(U     ï‹q(hUElementqttQuu.     ïˆ       ^((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe258qU_idqMU_dataqU
  
  q	u.     ïg       Z((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe110qU_idqKnU_dataqU


q	u.     ïh       Y((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe126qU_idqK~U_dataqU

q	u.     ïi      ˆ((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUthingqUidqUe88qU_idq	KXU
_child_idsq
]q(KYK[KbKdKeKgKmeU
_child_mapq}q
(Km(U     ïtq(UProducts.XMLDocument.NodeqUTextqttQK[(U     ïuq(hUElementqttQKY(U     ïvq(hUTextqttQKg(U     ïwq(hUElementqttQKe(U     ïxq(hUTextqttQKd(U     ïyq(hUElementqttQKb(U     ïzq(hUTextqttQuu.     ïj       X((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe86qU_idqKVU_dataqU

q	u.     ïk      H((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUthingqUidqUe113qU_idq	KqU
_child_idsq
]q(KrKtKuKwK}eU
_child_mapq}q
(K}(U     ïlq(UProducts.XMLDocument.NodeqUTextqttQKw(U     ïmq(hUElementqttQKu(U     ïnq(hUTextqttQKt(U     ïoq(hUElementqttQKr(U     ïpq(hUTextqttQuu.     ï‘       Æ((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUbodyqUidqUe293qU_idq	M%U
_child_idsq
]qM&aU
_child_mapq}q
M&(U     ï”q(UProducts.XMLDocument.NodeqUTextqttQsu.     ï’       ]((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe291qU_idqM#U_dataqU
    q	u.     ï“       [((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe304qU_idqM0U_dataqU
  q	u.     ï       \((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe238qU_idqKîU_dataqU
    q	u.     ïŽ       [((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe256qU_idqM U_dataqU
  q	u.     ï       Ã((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUbodyqUidqUe240qU_idq	KðU
_child_idsq
]qKñaU
_child_mapq}q
Kñ(U     ïq(UProducts.XMLDocument.NodeqUTextqttQsu.     ï‰       ]((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe263qU_idqMU_dataqU
    q	u.     ïŠ       [((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe284qU_idqMU_dataqU
  q	u.     ï‹       Æ((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUbodyqUidqUe265qU_idq	M	U
_child_idsq
]qM
aU
_child_mapq}q
M
(U     ïŒq(UProducts.XMLDocument.NodeqUTextqttQsu.     ït       V((UProducts.XMLDocument.NodeqUTextqtqNt.}q(U_idqKmU_dataqU
UidqUe109qu.     ïu      ((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUheadqUidqUe91qU_idq	K[U
_child_idsq
]q(K\K^K_eU
_child_mapq}q
(K_(U     ï~q(UProducts.XMLDocument.NodeqUTextqttQK^(U     ïq(hUElementqttQK\(U     ï€q(hUTextqttQuu.     ïv       Y((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe89qU_idqKYU_dataqU
  q	u.     ïw      ((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUfeetqUidqUe103qU_idq	KgU
_child_idsq
]q(KhKjKkeU
_child_mapq}q
(Kk(U     ï{q(UProducts.XMLDocument.NodeqUTextqttQKj(U     ï|q(hUElementqttQKh(U     ï}q(hUTextqttQuu.     ïx       Z((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe101qU_idqKeU_dataqU
  q	u.     ïy       ‡((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUbodyqUidqUe100qU_idq	KdU
_child_idsq
]qU
_child_mapq}q
u.     ïz       Y((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe98qU_idqKbU_dataqU
  q	u.     ïl       V((UProducts.XMLDocument.NodeqUTextqtqNt.}q(U_idqK}U_dataqU
UidqUe125qu.     ïm      ((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUsecondqUidqUe119qU_idq	KwU
_child_idsq
]q(KxKzK{eU
_child_mapq}q
(K{(U     ïqq(UProducts.XMLDocument.NodeqUTextqttQKz(U     ïrq(hUElementqttQKx(U     ïsq(hUTextqttQuu.     ïn       Z((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe117qU_idqKuU_dataqU
  q	u.     ïo       ˆ((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUfirstqUidqUe116qU_idq	KtU
_child_idsq
]qU
_child_mapq}q
u.     ïp       Z((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe114qU_idqKrU_dataqU
  q	u.     ï”       ±((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe294qU_idqM&U_dataqUY
    This slide is red.

    All the others are grey.

    The magic is acquisition.
    q	u.     ï       Ö((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe241qU_idqKñU_dataqU
    This is the first slide

    Here are some points,
    that I want to make:

      * one thing

      * another thing
    q	u.     ïŒ       ð((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe266qU_idqM
U_dataqU˜
    This is the second slide

    Here are some points,
    that I want to make:

      1. one thing

      2. another thing

      3. final point
    q	u.     ï~       [((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe95qU_idqK_U_dataqU  
  q	u.     ï       †((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUhairqUidqUe94qU_idq	K^U
_child_idsq
]qU
_child_mapq}q
u.     ï€       [((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe92qU_idqK\U_dataqU
    q	u.     ï{       Z((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe107qU_idqKkU_dataqU
  q	u.     ï|       ‡((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUtoesqUidqUe106qU_idq	KjU
_child_idsq
]qU
_child_mapq}q
u.     ï}       \((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe104qU_idqKhU_dataqU
    q	u.     ïq       Z((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe123qU_idqK{U_dataqU
  q	u.     ïr       ˆ((U Products.XMLDocument.XMLDocumentqUElementqtqNt.}q(U_nameqUthirdqUidqUe122qU_idq	KzU
_child_idsq
]qU
_child_mapq}q
u.     ïs       \((UProducts.XMLDocument.NodeqUTextqtqNt.}q(UidqUe120qU_idqKxU_dataqU
    q	u.ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

=== Added File Products/XMLDocument/Node.py === (865/965 lines abridged)
##############################################################################
# 
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
# 
# Copyright (c) Digital Creations.  All rights reserved.
# 
# This license has been certified as Open Source(tm).
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions in source code must retain the above copyright
#    notice, this list of conditions, and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions, and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 
# 3. Digital Creations requests that attribution be given to Zope
#    in any manner possible. Zope includes a "Powered by Zope"
#    button that is installed by default. While it is not a license
#    violation to remove this button, it is requested that the
#    attribution remain. A significant investment has been put
#    into Zope, and this effort will continue if the Zope community
#    continues to grow. This is one way to assure that growth.
# 
# 4. All advertising materials and documentation mentioning
#    features derived from or use of this software must display
#    the following acknowledgement:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    In the event that the product being advertised includes an
#    intact Zope distribution (with copyright and license included)
#    then this clause is waived.
# 
# 5. Names associated with Zope or Digital Creations must not be used to
#    endorse or promote products derived from this software without
#    prior written permission from Digital Creations.
# 
# 6. Modified redistributions of any form whatsoever must retain
#    the following acknowledgment:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment

[-=- -=- -=- 865 lines omitted -=- -=- -=-]


class Comment(Acquisition.Explicit, CharacterData, Node, ZDOM.Node, Persistent):
    """
    Comment Node
    """
    
    nodeType=COMMENT_NODE
    _name="#comment"
    _child_ids=()
    
    def __init__(self, data):
        self._data=data
        
    def toXML(self, deep=1, RESPONSE=None):
        """
        DOM tree as XML from this Node.
        If 'deep' is false, just return the XML of this node and
        its attributes.
        """
        if RESPONSE is not None:
            RESPONSE.setHeader('content-type','text/xml')
        return "<!--%s-->" % self._data
        
    def cloneNode(self, deep=0):
        """
        Returns a duplicate of this node, i.e., serves as a generic copy
        constructor for nodes. The duplicate node has no parent.
    
        Cloning an Element copies all attributes and their values, including
        those generated by the XML processor to represent defaulted
        attributes, but this method does not copy any text it contains unless
        it is a deep clone, since the text is contained in a child Text node.
        Cloning any other type of node simply returns a copy of this node. 
        """
        return self.getOwnerDocument().createComment(self._data)
  
  
class DocumentFragment(Acquisition.Implicit, Node, ZDOM.Node, Persistent):
    """
    Document Fragment
    """
    nodeType=DOCUMENT_FRAGMENT_NODE
    _name="#document-fragment"
    
    def __init__(self):
        self._child_ids=[]
        self._child_map={}
        
         
    


=== Added File Products/XMLDocument/README.txt ===
Welcome to XML Document, a Zope Product for XML support

What is it?

  XML Document allows you to use xml objects in the Zope environment.
  You can create xml documents in Zope and leverage Zope to format,
  query, and manipulate xml.

What is the status of this product?

  This release is *alpha* quality. This means that it is not feature
  complete, nor is it bug free. This release is also not supported.
  This means we will answer questions and fix problems as time
  permits.

How can I get involved?

  DC doesn't currently have a lot of time to spend on this project.
  This means motivated and opinionated Zope developers are more than
  welcome to contribute ideas and code to this project.

Examples

  The included Example.zexp file can be imported into Zope to give you
  a working example of how to use XML Document.

Requirements

  This release requires Zope 2.0.0 beta 2 or later.

Features

  The XML Document product parses xml into a Zopish DOM tree. The
  individual elements of the tree are true Zope object with id's,
  properties, acquisition support, persistence, etc. The document and
  individual sub-elements can be edited trough the management
  interface.
  
  By turning xml into Zope objects you can leverage all the Zopish
  things you know and love to xml. For example you can format xml with
  DTML Methods. You can use URL traversal to locate specific elements
  in the DOM. You can acquire methods and call them on specific
  elements. You can catalog xml elements.

  URL traversal

    When xml is parsed into a DOM tree, sub-elements are created and
    given ids. You can then use URLs to navigate to specific elements.
    URL traversal works in two ways, by *id* and by sequence *index*.

      id traversal
      
        This works normally, in the same way can traverse all objects
        in the Zope object hierarchy by id. For example,
      
          'myDoc/e5/e7/myMethod'
        
        This URL traverses from an XML Document object with id
        'myDoc', to a sub-element with id, 'e5', to a sub-element with
        id 'e7' and then to an acquired method with id 'myMethod'.
     
        Since node ids are generated automatically and can change when
        the xml content of a document is reparsed, this method of URL
        traversal has some short-comings. For example, URLs of this
        type probably shouldn't be bookmarked since they could change
        when the xml document is changed.
     
      sequence index traversal
     
        This form of traversal uses an element's index within its
        parent
        rather than its id as URL key. For example,
      
          'myDoc/0/2/myMethod'
        
        This URL traverses from an XML Document object with id 'myDoc'
        to it's first sub-element, to that element's second
        sub-element
        to an acquired method with id 'myMethod'

  Sequence and mapping interface
  
    XML Documents and elements support the Python sequence interface
    for access to sub-elements. At present this support is limited.
    
    For example in DTML you access sub-elements like so::
    
      <!--#var "myDoc[0][4][1].myMethod()"-->
      
    This calls 'myMethod' on a sub-element which is several levels
    deep in the DOM tree.
   
    You can also use the sequence interface to manipulate the DOM
    tree. For example::

      <!--#call "myDoc[0][1]=myDoc[0][5]"-->

    This replaces one sub-node with an other.
 
    In addition, you can access sub-elements by id via the mapping
    interface::
    
      <!--#var "myDoc['e5']['e25'][1].myMethod()"-->

    This example shows sub-element access via a combination of id and
    index style access.

    Note, you can not currently access sub-elements via 'getattr'
    style access. In other words this won't work::
    
      <!--#var "myDoc.e5.e25.myMethod()"--> # wrong

  DOM API support

    The DOM tree created by Zope aims to comply with the DOM level one
    standard. This allows you to access your xml in DTML or External
    Methods using a standard and powerful API.
   
    Currently the DOM support is a little incomplete, and has not be
    completely tested.

    The DOM tree is not built with the xml-sig's DOM package, because
    it requires significantly different node classes.

    Another divergence from the DOM API is that DOM attributes are
    made available as methods not attributes. These attributes are
    named by prepending 'get' to the attribute name. For example, the
    'firstChild' attribute is available via the 'getFirstChild'
    method.
    
    Note, the XML Document DOM is based on the general purpose Zope
    DOM (ZDOM). The XML Document Product provides a superset of the
    ZDOM.
    
  ObjectManager API support

    XML Documents and elements support the read methods of the
    ObjectManger API. These methods include 'objectIds',
    'objectValues', and 'objectItems'. For example::

      <!--#in "objectValues('book')"-->
      <!--#var author--><br>
      <!--#/in-->
    
    This would iterate through all sub-elements with a tag name of
    'book' and would print the 'author' attribute of each sub-element.
  
  Attributes and properties
  
    XML attributes are mapped to Zope properties. You can edit these
    values via the standard Zope property management interface and the
    changes are reflected in the xml of an element. You can also edit
    attributes by editing the xml and these changes are reflected in
    the Zope property interface. You can also use standard Zope
    property management methods from DTML and External Methods to
    change properties.
  
  Meta types
  
    The meta type of an XML Document is 'XML Document'. The meta type
    of sub-Elements of XML Documents is given by their tag name.
  
  Editing xml with the management interface

    XML Documents are elements are editable via the management
    interface. Documents can be created by uploading xml files.
    
  FTP and PUT
  
    You can edit XML Documents through the ZServer FTP server. You can
    also use WebDAV and HTTP PUT to update existing XML Document
    objects.
    
    You cannot create new XML Document objects with FTP, WebDAV or
    PUT.
    
Limitations

  This release is *alpha* quality.
  
  DOM limitations
  
    The currently DOM implementation is incomplete, and most probably
    contains bugs.
  
Futures

  The XML Document Product has a long way to go. This is a summary of
  planned improvements. If you don't see what you want here, you're in
  luck, this is open source software! You can extend this product
  yourself or pay someone (including Digital Creations) to extend it
  for you.
  
  In the short term as time permits, we plan to,
      
    * Verify that the DOM implementation is fairly complete and
    correct.

    * Improve management interface.

    * Improve performance, especially for very large xml documents.

  In the longer run plans include,

    * Provide an ability to bind ZClasses to specific Element types.
    This is similar to ZSQL Method's notion of brains.

    * More completely support Zope management and object protocols.

    * Provide XML validation services.
    


=== Added File Products/XMLDocument/XMLDocument.py ===
##############################################################################
# 
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
# 
# Copyright (c) Digital Creations.  All rights reserved.
# 
# This license has been certified as Open Source(tm).
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions in source code must retain the above copyright
#    notice, this list of conditions, and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions, and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 
# 3. Digital Creations requests that attribution be given to Zope
#    in any manner possible. Zope includes a "Powered by Zope"
#    button that is installed by default. While it is not a license
#    violation to remove this button, it is requested that the
#    attribution remain. A significant investment has been put
#    into Zope, and this effort will continue if the Zope community
#    continues to grow. This is one way to assure that growth.
# 
# 4. All advertising materials and documentation mentioning
#    features derived from or use of this software must display
#    the following acknowledgement:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    In the event that the product being advertised includes an
#    intact Zope distribution (with copyright and license included)
#    then this clause is waived.
# 
# 5. Names associated with Zope or Digital Creations must not be used to
#    endorse or promote products derived from this software without
#    prior written permission from Digital Creations.
# 
# 6. Modified redistributions of any form whatsoever must retain
#    the following acknowledgment:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    Intact (re-)distributions of any official Zope release do not
#    require an external acknowledgement.
# 
# 7. Modifications are encouraged but must be packaged separately as
#    patches to official Zope releases.  Distributions that do not
#    clearly separate the patches from the original work must be clearly
#    labeled as unofficial distributions.  Modifications which do not
#    carry the name Zope may be packaged in any form, as long as they
#    conform to all of the clauses above.
# 
# 
# Disclaimer
# 
#   THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
#   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
#   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
#   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#   SUCH DAMAGE.
# 
# 
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations.  Specific
# attributions are listed in the accompanying credits file.
# 
##############################################################################
"""
Python Product for XML Documents
"""

import Node
from Node import Text, Comment, ProcessingInstruction, CDATASection, \
    DocumentFragment
from Globals import HTMLFile, MessageDialog
from DateTime import DateTime
import string
from urllib import quote
import Builder
from OFS import ZDOM

class Manageable:
    """
    Mix-in for Zope management
    """

    isPrincipiaFolderish=1
                             
    manage_options=({'label':'Edit', 'action':'manage_editForm'},
                    {'label':'Upload', 'action':'manage_uploadForm'},
                    {'label':'Properties', 'action':'manage_propertiesForm'},
                    {'label':'Security',   'action':'manage_access'},
                    )
                    
    __ac_permissions__=(
    ('Access contents information',
        ('objectIds', 'objectValues', 'objectItems', 'getfirstChild', 'getlastChild',
         'getNextSibling', 'getPreviousSibling', 'getChildNodes', 'getParentNode',
         'getOwnerDocument', 'getElementsByTagName', 'nextObject', 'previousObject'),
        ('Anonymous', 'Manager')),
    ('View management screens',
        ('manage', 'manage_main', 'manage_editForm', 'manage_uploadForm')),
    ('Change XML Documents',
        ('manage_edit', 'manage_upload', 'insertBefore', 'appendChild',
         'removeChild', 'cloneNode', 'normalize', 'setAttribute',
         'setAttributeNode', 'removeAttribute', 'removeAttributeNode',
         'parse', 'PUT', 'createElement', 'createTextNode', 'createCDATASection',
         'createComment', 'createProcessingInstruction', 'createDocumentFragment'
         )),
    ('View',
        ('', 'text_content', 'getnodeType', 'getnodeValue', 'toXML',
         'document_src', 'getAttribute', 'getAttributes')),
    ('Manage properties', 
        ('manage_addProperty', 'manage_editProperties', 'manage_delProperties',
         'manage_changeProperties',)),
    ('FTP access', ('manage_FTPstat','manage_FTPget','manage_FTPlist')),
    )

    # Content Editing Methods
    # -----------------------
    
    manage_uploadForm=HTMLFile('documentUpload', globals())

    def get_size(self): return len(self.toXML())

    _size_changes={
        'Bigger': (5,5),
        'Smaller': (-5,-5),
        'Narrower': (0,-5),
        'Wider': (0,5),
        'Taller': (5,0),
        'Shorter': (-5,0),
        }

    def _er(self,data,title,SUBMIT,dtpref_cols,dtpref_rows,REQUEST):
        dr,dc = self._size_changes[SUBMIT]
        rows=max(1,string.atoi(dtpref_rows)+dr)
        cols=max(40,string.atoi(dtpref_cols)+dc)
        e=(DateTime('GMT') + 365).rfc822()
        resp=REQUEST['RESPONSE']
        resp.setCookie('dtpref_rows',str(rows),path='/',expires=e)
        resp.setCookie('dtpref_cols',str(cols),path='/',expires=e)
        return self.manage_editForm(
            self,REQUEST,title=title,toXML=data,
            dtpref_cols=cols,dtpref_rows=rows)

    def manage_edit(self,data,title=None,SUBMIT='Change',dtpref_cols='50',
                    dtpref_rows='20',REQUEST=None):
        """
        Replaces a Documents contents with Data, Title with Title.

        The SUBMIT parameter is also used to change the size of the editing
        area on the default Document edit screen.  If the value is "Smaller",
        the rows and columns decrease by 5.  If the value is "Bigger", the
        rows and columns increase by 5.  If any other or no value is supplied,
        the data gets checked for DTML errors and is saved.
        """
        if self._size_changes.has_key(SUBMIT):
            return self._er(data,title,SUBMIT,dtpref_cols,dtpref_rows,REQUEST)
        if title is not None:
            self.title=title
        try:
            self.parse(data)
        except Builder.ParseError, message:
            if REQUEST:
                return self.manage_editForm(self, REQUEST, toXML=data,
                        manage_tabs_message='<font color="red">XML Parsing Error: %s</font>' % message)
        if REQUEST:
            message="Content changed."
            return self.manage_editForm(self, REQUEST, manage_tabs_message=message)

    def manage_upload(self, file='', REQUEST=None):
        """Replace the contents of the document with the text in file."""  
        try:
            self.parse(file)
        except Builder.ParseError, message:
            if REQUEST: return MessageDialog(
                    title  ='XML Parsing Error',
                    message=message,
            action ='manage_workspace') 
        if REQUEST: return MessageDialog(
                    title  ='Success!',
                    message='Your changes have been saved',
                    action ='manage_workspace')

    def manage_afterAdd(self, item, container): pass
    def manage_beforeDelete(self, item, container): pass
    def manage_afterClone(self, item): pass
    

# Node classes
# ------------

class Document(Manageable, Node.Document):
    """
    XML Document Zope object
    """

    meta_type='XML Document'

    manage=manage_main=manage_editForm=HTMLFile('documentEdit', globals())

    def _get_builder(self):
        # returns a DOM builder 
        return DOMBuilder()
        
    def _build_tree(self, data):
        # Return a DOM tree given XML data.
        # This tree has no ownerDocument
        p=self._get_builder()
        p.reset()
        p.parse(data)
        return p.root.getDocumentElement().aq_base
   
    def parse(self, data):
        """
        Build a DOM tree rooted in this node given XML text or file object.
        """
        self._clear()
        p=self._get_builder()
        p.reset(self)
        p.parse(data)

    # DOM write methods
    # -----------------
    
    def createElement(self, tagName):
        """
        Creates an element of the type specified. Note that the instance
        returned implements the Element interface, so attributes can be
        specified directly on the returned object. 
        """
        return self._get_builder().nodes[ZDOM.ELEMENT_NODE](tagName)
        
    def createTextNode(self, data):
        """
        Creates a Text node given the specified string. 
        """
        return self._get_builder().nodes[ZDOM.TEXT_NODE](data)
    
    def createCDATASection(self, data):
        """
        Creates a CDATASection node whose value is the specified string. 
        """
        return self._get_builder().nodes[ZDOM.CDATA_SECTION_NODE](data)
        
    def createComment(self, data):
        """
        Creates a Comment node given the specified string. 
        """
        return self._get_builder().nodes[ZDOM.COMMENT_NODE](data)

    def createProcessingInstruction(self, target, data):
        """
        Creates a ProcessingInstruction node given the specified
        name and data strings. 
        """
        return self._get_builder().nodes[ZDOM.PROCESSING_INSTRUCTION_NODE](data)
         
    def createAttribute(self, name):
        """
        Creates an Attr of the given name. Note that the Attr instance can then
        be set on an Element using the setAttribute method. 
        """
        return self._get_builder().nodes[ZDOM.ATTRIBUTE_NODE](name,'')
       
    def createDocumentFragment(self):
        """
        Creates an empty DocumentFragment object.
        """
        return self._get_builder().nodes[ZDOM.DOCUMENT_FRAGMENT_NODE]()
       
    # Protocol handlers
    # -----------------
     
    def PUT(self, REQUEST, RESPONSE):
        """Handle HTTP PUT requests"""
        self.dav__init(REQUEST, RESPONSE)
        body=REQUEST.get('BODY', '')   
        self.parse(body)
        RESPONSE.setStatus(204)
        return RESPONSE        
     
    def manage_FTPget(self):
        "Get source for FTP download"
        return self.toXML()
     
     
class Element(Manageable, Node.Element):
    """
    XML Element Zope object
    """

    icon="misc_/XMLDocument/xml_element.gif"

    def parse(self, data):
        """
        Build a DOM tree rooted in this node given XML text or file object.
        """
        e=self.aq_acquire('_build_tree')(data)
        self._child_map=e._child_map
        self._child_ids=e._child_ids
        self._properties=e._properties
        for k,v in e.propertyItems():
            setattr(self, k, v)
            
    manage_editForm=HTMLFile('elementEdit', globals())
        
        
# DOM Builder class
# -----------------

class DOMBuilder(Builder.Builder):
    nodes={
        ZDOM.DOCUMENT_NODE : Document,
        ZDOM.DOCUMENT_FRAGMENT_NODE : DocumentFragment,
        ZDOM.ELEMENT_NODE : Element,
        ZDOM.TEXT_NODE : Text,
        ZDOM.CDATA_SECTION_NODE : CDATASection,
        ZDOM.COMMENT_NODE : Comment,
        ZDOM.PROCESSING_INSTRUCTION_NODE : ProcessingInstruction,
        ZDOM.ATTRIBUTE_NODE : ZDOM.Attr,
        }
        
# Add form and method
# -------------------

addForm=HTMLFile('documentAdd', globals())

def add(self, id, title='', file='', REQUEST=None, submit=None):
    """
    Add a XML Document object with the contents of file.
    """
    ob=Document()
    ob.title=title
    ob.id=id
    if file: ob.parse(file)
    id=self._setObject(id, ob)
    if REQUEST is not None:
        try: u=self.DestinationURL()
        except: u=REQUEST['URL1']
        if submit==" Add and Edit ": u="%s/%s" % (u,quote(id))
        REQUEST.RESPONSE.redirect(u+'/manage_main')
    return ''


=== Added File Products/XMLDocument/__init__.py ===
##############################################################################
# 
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
# 
# Copyright (c) Digital Creations.  All rights reserved.
# 
# This license has been certified as Open Source(tm).
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions in source code must retain the above copyright
#    notice, this list of conditions, and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions, and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 
# 3. Digital Creations requests that attribution be given to Zope
#    in any manner possible. Zope includes a "Powered by Zope"
#    button that is installed by default. While it is not a license
#    violation to remove this button, it is requested that the
#    attribution remain. A significant investment has been put
#    into Zope, and this effort will continue if the Zope community
#    continues to grow. This is one way to assure that growth.
# 
# 4. All advertising materials and documentation mentioning
#    features derived from or use of this software must display
#    the following acknowledgement:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    In the event that the product being advertised includes an
#    intact Zope distribution (with copyright and license included)
#    then this clause is waived.
# 
# 5. Names associated with Zope or Digital Creations must not be used to
#    endorse or promote products derived from this software without
#    prior written permission from Digital Creations.
# 
# 6. Modified redistributions of any form whatsoever must retain
#    the following acknowledgment:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    Intact (re-)distributions of any official Zope release do not
#    require an external acknowledgement.
# 
# 7. Modifications are encouraged but must be packaged separately as
#    patches to official Zope releases.  Distributions that do not
#    clearly separate the patches from the original work must be clearly
#    labeled as unofficial distributions.  Modifications which do not
#    carry the name Zope may be packaged in any form, as long as they
#    conform to all of the clauses above.
# 
# 
# Disclaimer
# 
#   THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
#   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
#   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
#   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#   SUCH DAMAGE.
# 
# 
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations.  Specific
# attributions are listed in the accompanying credits file.
# 
##############################################################################
"""
XML Document Product
"""
import XMLDocument
from Globals import ImageFile
import OFS.misc_

def initialize(context):
    context.registerClass(
        XMLDocument.Document,
        permission='Add XML Documents',
        constructors=(XMLDocument.addForm, XMLDocument.add),
        icon='xml_doc.gif'
        )
    context.registerBaseClass(XMLDocument.Document)
    
    # manual icon registration for XMLElement
    icon=ImageFile('xml_element.gif', globals())
    icon.__roles__=None
    OFS.misc_.misc_.XMLDocument['xml_element.gif']=icon
    


=== Added File Products/XMLDocument/documentAdd.dtml ===
<HTML>
<HEAD>
<TITLE>Add XML Document</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<H2>Add XML Document</H2>


<P>
You may create a new XML Document using the form below. 
You may also choose to upload an existing XML file from your
local computer by clicking the <I>Browse</I> button.
</P>

<FORM ACTION="add" METHOD="POST"
      ENCTYPE="multipart/form-data">
<TABLE CELLSPACING="2">
<TR>
  <TH ALIGN="LEFT" VALIGN="TOP">Id</TH>
  <TD ALIGN="LEFT" VALIGN="TOP"><INPUT TYPE="TEXT" NAME="id" SIZE="40"></TD>
</TR>
<TR>
  <TH ALIGN="LEFT" VALIGN="TOP"><EM>Title</EM></TH>
  <TD ALIGN="LEFT" VALIGN="TOP"><INPUT TYPE="TEXT" NAME="title" SIZE="40"></TD>
</TR>
<TR>
  <TH ALIGN="LEFT" VALIGN="TOP"><EM><STRONG>File</STRONG></EM></TD>
  <TD ALIGN="LEFT" VALIGN="TOP">
     <INPUT TYPE="file" NAME="file" SIZE="25" VALUE="">
  </TD>
</TR>
<TR><TH></TH>
    <TD>
       <INPUT TYPE="SUBMIT" VALUE=" Add ">
       <INPUT TYPE="SUBMIT" VALUE=" Add and Edit " NAME="submit">
    </TD>
</TR>
</TABLE>
</FORM>
</BODY></HTML>



=== Added File Products/XMLDocument/documentEdit.dtml ===
<HTML>
<HEAD>
<TITLE>Edit</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<!--#var manage_tabs-->

  <FORM ACTION="manage_edit" METHOD="POST">
    <TABLE CELLSPACING="2">
      <TR>
	<TH ALIGN="LEFT" VALIGN="TOP">Id</TH>
	<TD ALIGN="LEFT" VALIGN="TOP"><!--#var id--></TD>
      </TR>
      <TR>
	<TH ALIGN="LEFT" VALIGN="TOP"><EM>Title</EM></TH>
	<TD ALIGN="LEFT" VALIGN="TOP">
	<!--#if title-->
	<INPUT TYPE="TEXT" NAME="title" SIZE="40" VALUE="<!--#var title-->">
	<!--#else title-->
	<INPUT TYPE="TEXT" NAME="title" SIZE="40" VALUE="">
	<!--#/if title-->
	</TD>
      </TR>
      <tr>
	<th align="left" valign="top">
        <em>Size</em>
        </th>
	<td align="left" valign="top">
        <!--#var get_size thousands_commas--> bytes
	</td>
      </tr>
      <tr>
	<th align="left" valign="top">
        <em>Last modified</em>
        </th>
	<td align="left" valign="top">
        <!--#var bobobase_modification_time-->
	</td>
      </tr>
      <TR>
	<TD COLSPAN="2" ALIGN="CENTER">
	<TEXTAREA NAME="data:text" WRAP="Off"
	<!--#if dtpref_cols-->
	COLS="<!--#var dtpref_cols-->"
	<!--#else dtpref_cols-->
	COLS="50"
	<!--#/if dtpref_cols-->
	<!--#if dtpref_rows-->
	ROWS="<!--#var dtpref_rows-->"
	<!--#else dtpref_rows-->
	ROWS="20"
	<!--#/if dtpref_rows-->><!--#var 
        toXML html_quote--></TEXTAREA>
	</TD>
      </TR>
      <TR>
	<TD align=left>
          <INPUT NAME=SUBMIT TYPE="SUBMIT" VALUE="Change">
	</TD>
	<TD align=left>
	  <INPUT NAME=SUBMIT TYPE="SUBMIT" VALUE="Taller">
	  <INPUT NAME=SUBMIT TYPE="SUBMIT" VALUE="Shorter">
	  <INPUT NAME=SUBMIT TYPE="SUBMIT" VALUE="Wider">
	  <INPUT NAME=SUBMIT TYPE="SUBMIT" VALUE="Narrower">
	</TD>
      </TR>
    </TABLE>
  </FORM>
</BODY>
</HTML>



=== Added File Products/XMLDocument/documentUpload.dtml ===
<HTML>
<HEAD>
<TITLE>Upload</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<!--#var manage_tabs-->

<P>
You may upload the source for <!--#var title_and_id--> using the form below.  
Choose an existing html file from your local computer by clicking the
<I>Browse</I> button.

<FORM ACTION="manage_upload" METHOD="POST"
 ENCTYPE="multipart/form-data">
<TABLE CELLSPACING="2">
<TR>
  <TH ALIGN="LEFT" VALIGN="TOP">File</TH>
  <TD ALIGN="LEFT" VALIGN="TOP">
  <INPUT TYPE="file" NAME="file" SIZE="25" VALUE="">
  </TD>
</TR>
<TR>
  <TD></TD>
  <TD><BR><INPUT TYPE="SUBMIT" VALUE="Change"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>



=== Added File Products/XMLDocument/elementEdit.dtml ===
<HTML>
<HEAD>
<TITLE>Edit</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<!--#var manage_tabs-->

  <FORM ACTION="manage_edit" METHOD="POST">
    <TABLE CELLSPACING="2">
      <TR>
	<TH ALIGN="LEFT" VALIGN="TOP">Id</TH>
	<TD ALIGN="LEFT" VALIGN="TOP"><!--#var id--></TD>
      </TR>
      <tr>
	<th align="left" valign="top">
        <em>Size</em>
        </th>
	<td align="left" valign="top">
        <!--#var get_size thousands_commas--> bytes
	</td>
      </tr>
      <tr>
	<th align="left" valign="top">
        <em>Last modified</em>
        </th>
	<td align="left" valign="top">
        <!--#var bobobase_modification_time-->
	</td>
      </tr>
      <TR>
	<TD COLSPAN="2" ALIGN="CENTER">
	<TEXTAREA NAME="data:text" WRAP="Off"
	<!--#if dtpref_cols-->
	COLS="<!--#var dtpref_cols-->"
	<!--#else dtpref_cols-->
	COLS="50"
	<!--#/if dtpref_cols-->
	<!--#if dtpref_rows-->
	ROWS="<!--#var dtpref_rows-->"
	<!--#else dtpref_rows-->
	ROWS="20"
	<!--#/if dtpref_rows-->><!--#var 
        toXML html_quote--></TEXTAREA>
	</TD>
      </TR>
      <TR>
	<TD align=left>
          <INPUT NAME=SUBMIT TYPE="SUBMIT" VALUE="Change">
	</TD>
	<TD align=left>
	  <INPUT NAME=SUBMIT TYPE="SUBMIT" VALUE="Taller">
	  <INPUT NAME=SUBMIT TYPE="SUBMIT" VALUE="Shorter">
	  <INPUT NAME=SUBMIT TYPE="SUBMIT" VALUE="Wider">
	  <INPUT NAME=SUBMIT TYPE="SUBMIT" VALUE="Narrower">
	</TD>
      </TR>
    </TABLE>
  </FORM>
</BODY>
</HTML>



=== Added File Products/XMLDocument/version.txt ===
XML Document 1.0a2

=== Added File Products/XMLDocument/xml_doc.gif ===
  <Binary-ish file>

=== Added File Products/XMLDocument/xml_element.gif ===
  <Binary-ish file>




More information about the zopeorg-checkins mailing list