You are not logged in Log in Join
You are here: Home » Members » Martijn Faassen's Page » Parsed XML » EuroPython slides » View Document

Log in
Name

Password

 

EuroPython slides

Zope and XML

  • Martijn Faassen
  • Infrae (Rotterdam, the Netherlands)

Goals

  • document-centric XML
  • store documents in ZODB
  • view, edit, annotate, search XML in Zope

ParsedXML

  • Foundation to the rest
  • stores XML in the ZODB
  • allows DOM access for programmatic manipulation

Changes

  • rewrote and sped up ParsedXML's DOM wrappers
  • made it rely on PyXML, not carry around own Expat parser
  • pretty print
  • bugfixes and cleanups

Demo of ParsedXML

  • loading an XML document
  • viewing and editing
  • pretty printing
  • DOM access

NodePath

  • Currently part of ParsedXML, but just relies on DOM
  • allows paths to nodes in URLs
  • various path schemes
  • can be used for annotations and node event handling

NodePath schemes

  • child
  • element_id
  • robust

Scheme child

  • doc/child,3,1
  • works for all nodes
  • very unstable to changes
  • good for annotations of stable documents

Scheme element_id

  • doc/element_id,e0,e1
  • only works for elements
  • more stable to changes, but reparses break it
  • good for editor event handling

Scheme robust

  • doc/robust,zittingsdag1,resolutie3,p1,text2,23dat5is14de17middelen.*23
  • only really works for text nodes with text, heuristic
  • robust to all kinds of changes (but needs tuning)
  • good for annotations of evolving documents

Demo of NodePath

  • getNodePath(scheme)
  • resolving URLs

XMLWidgets

  • TTW Editors and viewers
  • Builds on ParsedXML and NodePath
  • Silva is built with it

Model/View/Controller for DOM Nodes

  • An XML Widget is a Folder, looked up dynamically
  • Model: XML DOM node (usually element node)
  • View: PageTemplates in widget folder
  • Controller: Python Scripts in widget folder

Demo of XMLWidgets

  • Silva document viewer
  • Silva document editor

XPathIndex

  • uses XPath from PyXML
  • catalog-like, but for XML documents and nodes
  • XPath to select what to index, NodePath to point to nodes
  • can work together with the ZCatalog

Demo of XPathIndex

  • filling index, filling catalog
  • search with catalog

Problems

  • ParsedXML is relatively slow
  • DOM not optimal representation for some tasks
  • PyXML/ParsedXML incompatibility
  • XML really needs unicode, Zope 2 not designed for it

Dreams: XSLT support

  • already prototypes available
  • needs nurturing and care

Dreams: libxml, libxslt, gdome integration

  • libraries in C, very fast in comparison
  • libxml and libxslt now have python bindings
  • issue: needs to be storable in ZODB (pickleable)

Dreams: storing XML in different way

  • store and index XML in non-tree form
  • allow fast (XPath) query
  • have prototype using ZODB and BTrees

Dreams: Zope 3

  • Hide functionality of various systems behind a clear set of interfaces
  • Let the system choose adapters to provide the functionalities.
  • for instance: DOMAdapter