You are not logged in Log in Join
You are here: Home » Members » roeder » README » View File

Log in
Name

Password

 

README

File details
Size
3 K
File type
text/plain

File contents

XML2Zope v0.2.1

    XML2Zope uses the normal xmllib version 0.2, which comes with Python
    1.5.2 if you don't have a later version installed seperately. 
    I recommend downloading Version 0.5.1 from python.org:
    "http://www.python.org/sigs/xml-sig/files/xml-0.5.1.tgz":http://www.python.org/sigs/xml-sig/files/xml-0.5.1.tgz

    To install XML2Zope, copy the XML2Zope.py file to the folder
    /your_zope_folder/Extensions/

    Then you need to access Zope with your browser and create an 
    "External Method" and enter the following:

    Id:                 XML2Zope
    Title:              XML2Zope
    Function Name:      XML2Zope
    Python module file: XML2Zope

    In Zope, you can use the following form, to upload XML files from the
    file system to Zope::

      <FORM ACTION="XML2Zope" METHOD="POST" ENCTYPE="multipart/form-data">
      <INPUT TYPE="file" NAME="xml">
      <INPUT TYPE="SUBMIT">
      </FORM>

    You can also convert XML files which which you have already uploaded into
    a Zope folder. In this case you just need to take care to actually upload
    your XML document as an "File", not a "DTML Document".
    The following form can be used to enter the Zope XML File which must exist
    in a reachable Folder::

      <FORM ACTION="XML2Zope" METHOD=POST>
      <INPUT TYPE="text" NAME="xml">
      <INPUT TYPE="SUBMIT">
      </FORM>

    The XML document will be loaded into a Zope folder hierarchy.
    XML Tags will be translated to Zope Folders and XML attributes will
    be translated to Zope properties. 

    To have Zope show the contents of this folder hierarchy, you may want
    to use something like this::

      <!--#with Adressen-->
       <!--#in "objectValues(['Folder'])"-->
        <!--#in "objectValues(['Folder'])"-->
         <!--#if "title=='Nachname'"-->
          <P>
          <!--#var data-->
         <!--#/if-->
        <!--#/in-->
       <!--#/in-->
      <!--#/with-->

    Or in Zope 2 Syntax::

      <dtml-with Adressen>
       <dtml-in "objectValues(['Folder'])">
        <dtml-in "objectValues(['Folder'])">
         <dtml-if "title=='Nachname'">
          <P>
          <dtml-var data>
         </dtml-if>
        </dtml-in>
       </dtml-in>
      </dtml-with>

    Please note, that title and data are not allowed as XML attributes,
    because of Zope limitations. 

    To allow for repeated Tags with the same name, a random number is appended
    to each tag name in the id.

    Also notice that the text between the opening and closing tags is saved in
    the data attribute of the folder with type text.

    Some care has been taken to allow for CDATA mixed with DATA. The following
    is all right::

      <title>
        sdfgdfg   
        <![CDATA[
        Interpolation <d><d>of Sparse Rational Functions without Knowing
        Bounds on Exponent]]> <![CDATA[ Interpolation <d><d>of Sparse Rational
        Functions without Knowing Bounds on Exponent.
        ]]>
        fgsdfg
      </title>

    CDATA text is transferred to Zope by filtering it through "html_quote".

  Please tell me what you think about XML2Zope !

  Maik Roeder
  mailto:[email protected]