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 ibrahim <ib...@natlab.research.philips.com> on 2001/01/30 17:13:44 UTC
Re: Parsing a schema for code generation
I read through this and find it interesting.
I have Xerces-J 1.2.2 validating my XML documents at the moment (using
DOMParser) and I need to make sure that any editings to those XML
documents conform the documents' corresponding XML Schema, on-the-fly or
real-time or whatever the term might be (hope I'm understandable enough
with these two terms..:P)
I would like to know what GrammarResolver is really doing. I'm not a
Java expert, so I don't think I would try to jump into the source code.
Could you explain to me or give me a site that explains it ? I find the
API not very describing... but again, it might be caused by my lack of
Java knowledge...
I read something about data-binding as well. Could you give me a
suggestion as which approach is more appropriate to take ? What's the
plus point of data-binding?
thx a lot,
cath
public class Parser extends SAXParser {
public XMLValidator getValidator() {
return fValidator;
}
}
...
Parser parser = new Parser();
XMLValidator validator = parser.getValidator();
GrammarResolver gr = new GrammarResolverImpl();
validator.setGrammarResolver(gr);
...
parser.parse(input);
Grammar g = gr.getGrammar(nameSpaceKey);
if(g != null && g instanceof SchemaGrammar) {
//etcetera
}