Python Tool for excerpting schema/examples into XHTML spec

I've attached a tool that excerpts schemas and examples into a XHTML spec. 
It actually contains two (proposal/implementation)s. 

The first (-r(egexp) is an implementation of a convention used by the XKMS 
editor (PHB) and uses <include> elements in the spec and xml comments in 
the external XML instances to demarcate the regions to excerpt. 
<include class="Code" source="Schemas/xkms.xsd" 
section="MessageAbstractType"></include>
<!-- MessageAbstractType --> blah blah <!-- /MessageAbstractType -->

The second (-x(ml) is my own approach and uses PIs with a XPtr. 
<?include class="Code" 
Source="Schemas/xkms.xsd#xpointer(//complexType[@name='RespondWith'])"?>

Source files for the -r(egexp) source spec, schema and examples can be found 
in the zip from [1]. For example:
  aeon:XKMS> pin.py -m r part-1-source.html out.html
[1] http://lists.w3.org/Archives/Public/www-xkms/2002Dec/0075

A dummy spec source file for the -x(ml) source spec is also attached, the 
schema and examples is the same as above. For example:
  aeon:XKMS> pin.py -m x test-xml-source.html out.html

Pros/cons for the approaches follow. 
'''
Include external xml chunks into an XHTML file
according two two different schemes:
regexp: within an XHTML file <include> elements indicate
  tokens to be used with a regular expression
  to excerpt external XML found between comments tags.
  (Source document is invalid; easy to demarcate contiguous
   regions, fast.)
xml: within an XHTML file <?pi?>'s specify an XPointer
  which indicates what XML to excerpt.
  (Source document is valid, requires no change to 
   schema and examples, flexible expressions; slower (i.e. XPath),
   not all XPath/XPointer expressions are supported presently.)
   Usage: pin.py -m [r(egexp)|x(ml)] input output'''

Received on Thursday, 23 January 2003 22:21:34 UTC