You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Andreas Schmidt <an...@team-konzept.de> on 2000/08/01 23:42:06 UTC

grammar based applications

i'm evaluating which is the best way to build an application, that relies 
on the grammar-definitions of xml-documents (dtd and schema). since i'm 
lazy, i expected the best way is to have a look at the sources of the 
xerces-validator, because the validator is an appication that has to work 
with these grammars too.

there i found several helpers (e.g. XMLElementDecl, XMLContentSpec, 
XMLAttributeDecl, (Schema-)Grammar, TraverseSchema) and it was quite easy, 
to build a first hack, that traverses a grammar and builds an application 
on top of a "GrammarHandler"-Interface:

	public interface GrammarHandler {
		public void startGrammar( ... );
		public void startElement( ... );
		public void addElementAttribute( ... );
		public void setElementContentSpec( ... );
		public void endElement();
		public void endGrammar();
	}
	
such a GrammarTraverser/GrammarHandler could be a general approach for 
building grammar based application.

right now, i have serval questions:

1. is there already a working solution for grammar based applications, that 
i haven't found

if not:

2. do you think, it makes sense, to build an grammar based application on 
top of the "SchemaGrammar"-classes. the more it comes to details, it seems, 
some important information of schema-based grammars gets lost (or is not 
accessable from outside) while transforming the schema-dom-tree into the 
schema-grammar (e.g. i can't find min/max-occurs-values)

3. would it be it possible, to extend the XMLContentSpec-classes in a way 
that all schema-related-information remains accessable (e.g. the ALL-model 
group is transformed into a choice of all permutations). the destination 
should be, that it's possible to reconstruct the original schema (or an 
equivalent) definition out of the grammar.

4. is anybody else interested in such an approach, so that it should be 
discussed in this list and maybe integrated into the xerces-project.


hope you have lots of comments.

thanks
	andi
--------------------------------------------------------------
Team-Konzept 		Andreas Schmidt
Gneisenaustr. 44/45 		email: andreas.schmidt@team-konzept.de
10961 Berlin 			phone: +49-30-690 471-0
Germany 			fax:   +49-30-690 471-99
--------------------------------------------------------------