ParsedXML Documentation / Examples?
Hello, After searching all afternoon, I have found a ton of periphery 'about' type information re: ParsedXML, but I am having trouble locating any substantive documentation, or in particular, examples. I'm interested in DTML examples, PythonScript examples, anything. Any pointers appreciated. -Bryan
zoper@disturbance.dhs.org wrote:
Hello,
After searching all afternoon, I have found a ton of periphery 'about' type information re: ParsedXML, but I am having trouble locating any substantive documentation, or in particular, examples. I'm interested in DTML examples, PythonScript examples, anything.
Any pointers appreciated.
-Bryan
Have you checked out ZopeXMLMethods instead? It's the latest/greatest XML Parser for zope. Works beautifully with 4Suite... or are you using ParsedXML for specific reasons? There's a great ZopeXMLMethods tutorial that gives you examples; it also comes with ready-to-go xml and xsl (the tutorial uses these). HTH, duncan
Duncan, Thanks for the response. I guess I should clarify a bit: I am looking for tools to aid in the creation of XML from a large, heierarchical set of data (well, large here = ~300 nodes) produced dynamically from an RDBMS, then store this XML document in a single text blob in the database - kind of a 'snapshot' of the current set of data. Later, the system will need to read, parse and display this data, and allow changes to specific nodes to be made, and then re-store the XML in the database. The reason for using XML here is that the creation of this data set is only complex the FIRST time it is generated (it will be generated per-user in the system I am working on), and so I want to avoid the nastiness of flattening the data for re-store in the DB. My thinking here is that once the original per-user complex generation is done, I just hang each user's data in a single XML set and manipulate that for the user's customizations going forward. What I do NOT need to do is have a ZMI interface to the XML, store the XML in the ZODB, and though it may be needed later, I also do not currently need to do XSLT transforms on the data. ZopeXMLMethods looks to be very specific to handling XSL transforms; ParsedXML, now that I have looked more deeply at it, seems focused on a ZMI interface to XML documents (though documentation indicates that it should be possible to use DTML to create and manipulate XML data). Anyone, please correct me if I am mistaken in the above statements. At this point, the shortest route to get what I want appears to be to use TTW Python Scripts and just deal with Python's native XML capabilities... comments? Any advice and / or personal anecdotes about what has worked for you and what hasn't would be appreciated. As with many projects, I am up against a deadline already passed. On Mon, 30 Jun 2003, Duncan M. McGreggor wrote:
zoper@disturbance.dhs.org wrote:
Hello,
After searching all afternoon, I have found a ton of periphery 'about' type information re: ParsedXML, but I am having trouble locating any substantive documentation, or in particular, examples. I'm interested in DTML examples, PythonScript examples, anything.
Any pointers appreciated.
-Bryan
Have you checked out ZopeXMLMethods instead? It's the latest/greatest XML Parser for zope. Works beautifully with 4Suite... or are you using ParsedXML for specific reasons?
There's a great ZopeXMLMethods tutorial that gives you examples; it also comes with ready-to-go xml and xsl (the tutorial uses these).
HTH,
duncan
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of zoper@disturbance.dhs.org Sent: martedi 1 luglio 2003 17.21 To: Duncan M. McGreggor Cc: zope-xml@zope.org; Zope Subject: Re: [Zope] ParsedXML Documentation / Examples?
Duncan,
Thanks for the response. I guess I should clarify a bit: I am looking for tools to aid in the creation of XML from a large, heierarchical set of data (well, large here = ~300 nodes) produced dynamically from an RDBMS, then store this XML document in a single text blob in the database - kind of a 'snapshot' of the current set of data.
I would write a simple product defining: 1. a folderish container class 2. a dtml-like class for storing the xml, something like: from somewhereInYourPythonPath import allTheNecessaryModules def addMyXMLFile(self, id, title='', REQUEST=None): "too lazy to use a docstring here" ob=myXMLFile(id, title, XMLStringContent) self._setObject(id, ob) self._getOb(id).reindex_object() message = """A new xmlFile as been added and the project schedule is back on track\n""" return MessageDialog(title = 'XML added', message = message.replace('\n','<br/>'), action = ".") class myXMLFile(CatalogAware, DTMLDocument.DTMLDocument) """you want a docstring, don't you?""" meta_type = 'My XML File' manage_options=DTMLDocument.DTMLDocument.manage_options def __init__(self, id, title, XMLContent): "initialise a new istance" DTMLDocument.DTMLDocument.__init__(self, XMLContent) self.id=id self.title=title Globals.default__class_init__(editableEoloXMLFile) Note that you have to supply the xml from your RDBMS as a string (in the correct encoding).
From now on you can do pretty everything you need to your XML. I use routinely XMLTransform (and soon its successor zopexmlmethods) and standard python XML tools.
I would also, probably, keep the xmlfile on the file system using localFS or the like (ie externalFile). Doing all this from external python code gives you, IMHO, a tremendous flexibility.
[...snip...] ZopeXMLMethods looks to be very specific to handling XSL transforms; ParsedXML, now that I have looked more deeply at it, seems focused on a ZMI interface to XML documents (though documentation indicates that it should be possible to use DTML to create and manipulate XML data).
Thats my understanding, too. I tend to use ZopeXMLMethods.
Anyone, please correct me if I am mistaken in the above statements.
At this point, the shortest route to get what I want appears to be to use TTW Python Scripts and just deal with Python's native XML capabilities... comments?
I would use external python code, as detailed above.
Any advice and / or personal anecdotes about what has worked for you and what hasn't would be appreciated. As with many projects, I am up against a deadline already passed.
The above mentioned architecture has proveed for me very useful and easy to mantain. I cannot, though, give you comment on performance, as my user application profile is quite light (i.e. less than 5 concurrent user on a xml base of less than 500 fragments). What for sure helps, is having many small xml documents rather than few big documents. I learned to automatically split imported xml document in subfolders, based on some high level tag in your xml tree. This gives you the added advantages of context sensitive (at folder level) search capabilities out of the box using Zcatalog. Hope this helps. --peppo PS: deadlines are already passed by definition. Othervise we would call them lifelines :)
obviously in the code example I gave: Globals.default__class_init__(editableEoloXMLFile) should read Globals.default__class_init__(myXMLFile) and the XMLStringContent variable is passed to the addMyXMLFile method in the REQUEST posted by a form. Apply the changes relevant to your real zooDB feeding scenario. --peppo
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Giuseppe Bonelli Sent: martedi 1 luglio 2003 18.37 To: zoper@disturbance.dhs.org Cc: zope-xml@zope.org; Zope Subject: RE: [Zope] ParsedXML Documentation / Examples?
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of zoper@disturbance.dhs.org Sent: martedi 1 luglio 2003 17.21 To: Duncan M. McGreggor Cc: zope-xml@zope.org; Zope Subject: Re: [Zope] ParsedXML Documentation / Examples?
Duncan,
Thanks for the response. I guess I should clarify a bit: I am looking for tools to aid in the creation of XML from a large, heierarchical set of data (well, large here = ~300 nodes) produced dynamically from an RDBMS, then store this XML document in a single text blob in the database - kind of a 'snapshot' of the current set of data.
I would write a simple product defining:
1. a folderish container class 2. a dtml-like class for storing the xml, something like:
from somewhereInYourPythonPath import allTheNecessaryModules
def addMyXMLFile(self, id, title='', REQUEST=None): "too lazy to use a docstring here" ob=myXMLFile(id, title, XMLStringContent) self._setObject(id, ob) self._getOb(id).reindex_object() message = """A new xmlFile as been added and the project schedule is back on track\n""" return MessageDialog(title = 'XML added', message = message.replace('\n','<br/>'), action = ".")
class myXMLFile(CatalogAware, DTMLDocument.DTMLDocument) """you want a docstring, don't you?""" meta_type = 'My XML File' manage_options=DTMLDocument.DTMLDocument.manage_options def __init__(self, id, title, XMLContent): "initialise a new istance" DTMLDocument.DTMLDocument.__init__(self, XMLContent) self.id=id self.title=title Globals.default__class_init__(editableEoloXMLFile)
Note that you have to supply the xml from your RDBMS as a string (in the correct encoding).
From now on you can do pretty everything you need to your XML. I use routinely XMLTransform (and soon its successor zopexmlmethods) and standard python XML tools.
I would also, probably, keep the xmlfile on the file system using localFS or the like (ie externalFile).
Doing all this from external python code gives you, IMHO, a tremendous flexibility.
[...snip...] ZopeXMLMethods looks to be very specific to handling XSL transforms; ParsedXML, now that I have looked more deeply at it, seems focused on a ZMI interface to XML documents (though documentation indicates that it should be possible to use DTML to create and manipulate XML data).
Thats my understanding, too. I tend to use ZopeXMLMethods.
Anyone, please correct me if I am mistaken in the above statements.
At this point, the shortest route to get what I want appears to be to use TTW Python Scripts and just deal with Python's native XML capabilities... comments?
I would use external python code, as detailed above.
Any advice and / or personal anecdotes about what has worked for you and what hasn't would be appreciated. As with many projects, I am up against a deadline already passed.
The above mentioned architecture has proveed for me very useful and easy to mantain. I cannot, though, give you comment on performance, as my user application profile is quite light (i.e. less than 5 concurrent user on a xml base of less than 500 fragments). What for sure helps, is having many small xml documents rather than few big documents. I learned to automatically split imported xml document in subfolders, based on some high level tag in your xml tree. This gives you the added advantages of context sensitive (at folder level) search capabilities out of the box using Zcatalog.
Hope this helps.
--peppo PS: deadlines are already passed by definition. Othervise we would call them lifelines :)
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Duncan M. McGreggor -
Giuseppe Bonelli -
zoper@disturbance.dhs.org