use of org.apache.xerces.jaxp.validation.XSGrammarPoolContainer in project webtools.sourceediting by eclipse.
the class CompleteNewApiTest method getGrammar.
// private Schema getSchema(InputStream schemaIs) throws SAXException {
// SchemaFactory sf = SchemaFactory
// .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
// Schema schema = sf.newSchema(new StreamSource(schemaIs));
// return schema;
// }
protected XSModel getGrammar(URL schemaURL) throws IOException, SAXException {
InputStream schemaIs = schemaURL.openStream();
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(new StreamSource(schemaIs));
XSGrammarPoolContainer poolContainer = (XSGrammarPoolContainer) schema;
XMLGrammarPool pool = poolContainer.getGrammarPool();
Grammar[] grammars = pool.retrieveInitialGrammarSet(XMLGrammarDescription.XML_SCHEMA);
XSGrammar[] xsGrammars = new XSGrammar[grammars.length];
System.arraycopy(grammars, 0, xsGrammars, 0, grammars.length);
return xsGrammars[0].toXSModel(xsGrammars);
}
use of org.apache.xerces.jaxp.validation.XSGrammarPoolContainer in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathTest method getGrammar.
protected XSModel getGrammar(URL schemaURL) throws IOException, SAXException {
InputStream schemaIs = testResolve(schemaURL);
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(new StreamSource(schemaIs));
XSGrammarPoolContainer poolContainer = (XSGrammarPoolContainer) schema;
XMLGrammarPool pool = poolContainer.getGrammarPool();
Grammar[] grammars = pool.retrieveInitialGrammarSet(XMLGrammarDescription.XML_SCHEMA);
XSGrammar[] xsGrammars = new XSGrammar[grammars.length];
System.arraycopy(grammars, 0, xsGrammars, 0, grammars.length);
return xsGrammars[0].toXSModel(xsGrammars);
}
use of org.apache.xerces.jaxp.validation.XSGrammarPoolContainer in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathWTPTest method getGrammar.
protected XSModel getGrammar(URL schemaURL) throws IOException, SAXException {
InputStream schemaIs = testResolve(schemaURL);
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(new StreamSource(schemaIs));
XSGrammarPoolContainer poolContainer = (XSGrammarPoolContainer) schema;
XMLGrammarPool pool = poolContainer.getGrammarPool();
Grammar[] grammars = pool.retrieveInitialGrammarSet(XMLGrammarDescription.XML_SCHEMA);
XSGrammar[] xsGrammars = new XSGrammar[grammars.length];
System.arraycopy(grammars, 0, xsGrammars, 0, grammars.length);
return xsGrammars[0].toXSModel(xsGrammars);
}
Aggregations