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


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Creating a valid document, schema driven.

You basically need the finite state machine representing the schema 
grammar. If you have the FSM, then you can keep track of what state you 
are in, and know what the valid transitions (edges) are to other 
permitted states. (Of course, there's a lot of usability to be built on 
top of that, but that's the essence.)

Then you have an engineering choice, whether to find some reusable 
componentry that builds the FSM from the grammar, or whether to write 
your own.  Saxon of course contains such an engine but you would 
probably be better off with something open source that you can adapt to 
your needs.

Michael Kay

On 17/06/2010 13:26, David wrote:
> Suppose in my Left Hand I have a Schema (Any format, DTD, XSD , RNG 
> ... I dont care because presumably I can convert to the right format 
> beforehand).
> And in my Right Hand I am constructing an XML document using some 
> document creation library (ideally in Java).
> At any given node, I should presumably know "where I'm at" in the 
> output, and also in the schema.
> I would like to inspect the correct schema node at this point and 
> given some magic rules I may have (In my Other Left Hand) pick one of 
> the allowable valid  set of attributes and nodes and write them  
> (Using values from my Other Right Hand).
> I have seen this done in some form in  varous GUI tools.  For example 
> this is a form of content completion or auto-suggest.
> Its also a form of "Generate an example XML from a Schema".
> What I am missing, and would love suggestions,  is what library or 
> combination of libraries would make this easiest or facilitate this.
> I belive I need
> * A library for constructing XML which lets me "know where I'm at" in 
> some fashion (xpath?)
> *** Or do I have to manually keep track of this somehow ?
> * A library for reading a schema and accessing its contents
> **  Must be able to be queried so that I can have a list of valid 
> nodes/attributes at any 'point'
> ** Must be able to be queried to find that 'point' given 'where I'm 
> At' in the output generation.
> Any suggestions or ideas on tools or approaches that together might 
> most easily be used to accomplish this ?
> I can provide more detail about what I'm trying to do if desired but I 
> suggest the general question is simpler (less constraining).
> Thanks for any ideas !

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

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

Copyright 1993-2007 XML.org. This site is hosted by OASIS