OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] Fun With Schemas

[ Lists Home | Date Index | Thread Index ]

Bullard, Claude L (Len) wrote:
> This one is fun.  I know that a validating editor 
> can use a schema or DTD to create a valid file.  
> Can a program do this for files it creates dynamically?
> Are there examples of this?
> This question came from a programmer who doesn't want 
> to hardwire the structure of files she creates into 
> the code that creates them.  I had replied with validation 
> on input (create the file, validate it then), and what 
> she actually wants to do is use the schema to drive 
> the file builder using say, SAX or its analog.

This *really* depends on what she wants to do. I've written tools to 
generate arbitrarily complex content based on an XML Schema or RelaxNG 
for testing purposes but the content was random and in fact rather 
meaningless. I never tried to do this generically (the tools always made 
a few assumptions as to how the schema was structured, though less so 
for RNG) but it should be possible (if at all useful). If that's the 
desired effect there's a certain amount of Perl lore on generating 
strings that correspond to a given regex that she may want to check.

If the idea is to produce content while at each step checking that it's 
feasably valid (for some meaning of that) then an implementation of DOM 
3 Validation should help.

If she wants to have code generated from a schema, then there are 
various ways to bind to a schema (generally XML Schema based) at one's 

Other than that, it's really hard to come up with a clearer answer 
without clearer requirements. Somehow I suspect that the second of my 
paragraphs above is the one closest to what is asked for, but I could be 
completely off.

Robin Berjon
   Research Scientist
   Expway, http://expway.com/

  • References:


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS