Personal tools
You are here: Home Members tseaver Software userschema userschema Issues Add XML format for specifying schemas
Issue 5 of userschema Issues [userschema]
Title: Add XML format for specifying schemas
Status: Resolved Security related: No
Description: It would be useful to have a trivially paresable XML format for defining schemas, exposing the full expressiveness of the Zope3 schema model to non-pr...
From: tseaver on: Jan 23, 07 17:47
tseaver Last update: Mar 28, 07 02:28
Topic/class: packaging/feature Importance: medium
Version info: Target: userschema-0.7
Issue 5 Transcript
3 entries
= Resolve - Entry #3 by tseaver on Mar 28, 2007 2:28 am

 Status: Pending => Resolved

Added for version 0.7.
________________________________________
= Comment - Entry #2 by tseaver on Jan 23, 2007 5:48 pm

We would likely need to be able to emit this XML format, too, which would
make integrating forms based Zope3 schema into Paul's 'agility' work more
straightforward.
________________________________________
= Request - Entry #1 by tseaver on Jan 23, 2007 5:47 pm

It would be useful to have a trivially paresable XML format for defining
schemas, exposing the full expressiveness of the Zope3 schema model to
non-programmers (both the CSV and HTML forms are subsests).

I would propose that we create a format based on an objectify-like
representation of a set of schemas, e.g., something like::

  <userschemas>
   <schema id="myschema">
    <target>dotted.path.for.generated.schema</target>
    <field>
     <type>dotted.path.to.field.interface</type>
     <name>field_name</name>
     <title>Display Title</title>
     <description>....</description>
     ....
    </field>
    ...
   </schema>
   ...
  </userschemas>

We would then add a ZCML directive, e.g.::

  <userschema:xmldefinition
    target="dotted.path" <!-- optional override -->
    package="dotted.path" <!-- for relative filenames -->
    file="filename.xml"
    schema="myschema"
    />

We might even get fance, and allow pulling out only some fields:

  <userschema:xmldefinition
    target="dotted.path" <!-- not optional for field subsets -->
    package="dotted.path" <!-- for relative filenames -->
    file="filename.xml"
    fields="//schema[@id=myschema]/...." <!-- XPath yielding field nodes -->
    />

Or, for extra bonus points, we could *combine* field sets, e.g.:

  <userschema:xmldefinition
    target="dotted.path"> <!-- required for this use case -->
   <userschema:xmlsubset
    package="dotted.path"
    file="filename.xml"
    schema="myschema"
    />
   <userschema:xmlsubset
    package="Products.CMFCore"
    filename="dublincore.xml"
    schema="simple_dublin_core"
    />
   </userschema:xmldefinition>
 
Note that, as with other forms of reuse, these last two options work
against the goal of making non-programmers responsible for specifying
schema definitions.

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: