private void checkTooManySchemaErrors() { if( opt.getGrammars().length!=1 ) errorReceiver.error(null,Messages.format(Messages.ERR_TOO_MANY_SCHEMA)); }
private void checkTooManySchemaErrors() { if( opt.getGrammars().length!=1 ) errorReceiver.error(null,Messages.format(Messages.ERR_TOO_MANY_SCHEMA)); }
private void checkTooManySchemaErrors() { if( opt.getGrammars().length!=1 ) errorReceiver.error(null,Messages.format(Messages.ERR_TOO_MANY_SCHEMA)); }
private void checkTooManySchemaErrors() { if( opt.getGrammars().length!=1 ) errorReceiver.error(null,Messages.format(Messages.ERR_TOO_MANY_SCHEMA)); }
private void checkTooManySchemaErrors() { if( opt.getGrammars().length!=1 ) errorReceiver.error(null,Messages.format(Messages.ERR_TOO_MANY_SCHEMA)); }
/** * Loads RELAX NG compact syntax */ private Model loadRELAXNGCompact() { if(opt.getBindFiles().length>0) errorReceiver.error(new SAXParseException( Messages.format(Messages.ERR_BINDING_FILE_NOT_SUPPORTED_FOR_RNC),null)); // TODO: entity resolver? Parseable p = new CompactParseable( opt.getGrammars()[0], errorReceiver ); return loadRELAXNG(p); }
/** * Loads RELAX NG compact syntax */ private Model loadRELAXNGCompact() { if(opt.getBindFiles().length>0) errorReceiver.error(new SAXParseException( Messages.format(Messages.ERR_BINDING_FILE_NOT_SUPPORTED_FOR_RNC),null)); // TODO: entity resolver? Parseable p = new CompactParseable( opt.getGrammars()[0], errorReceiver ); return loadRELAXNG(p); }
/** * Parses a set of schemas inside a WSDL file. * * A WSDL file may contain multiple <xsd:schema> elements. */ private XSSchemaSet loadWSDL() throws SAXException { // build DOMForest just like we handle XML Schema DOMForest forest = buildDOMForest( new XMLSchemaInternalizationLogic() ); DOMForestScanner scanner = new DOMForestScanner(forest); XSOMParser xsomParser = createXSOMParser( forest ); // find <xsd:schema>s and parse them individually for( InputSource grammar : opt.getGrammars() ) { Document wsdlDom = forest.get( grammar.getSystemId() ); NodeList schemas = wsdlDom.getElementsByTagNameNS(WellKnownNamespace.XML_SCHEMA,"schema"); for( int i=0; i<schemas.getLength(); i++ ) scanner.scan( (Element)schemas.item(i), xsomParser.getParserHandler() ); } return xsomParser.getResult(); }
/** * Parses a set of schemas inside a WSDL file. * * A WSDL file may contain multiple <xsd:schema> elements. */ private XSSchemaSet loadWSDL() throws SAXException { // build DOMForest just like we handle XML Schema DOMForest forest = buildDOMForest( new XMLSchemaInternalizationLogic() ); DOMForestScanner scanner = new DOMForestScanner(forest); XSOMParser xsomParser = createXSOMParser( forest ); // find <xsd:schema>s and parse them individually for( InputSource grammar : opt.getGrammars() ) { Document wsdlDom = forest.get( grammar.getSystemId() ); NodeList schemas = wsdlDom.getElementsByTagNameNS(WellKnownNamespace.XML_SCHEMA,"schema"); for( int i=0; i<schemas.getLength(); i++ ) scanner.scan( (Element)schemas.item(i), xsomParser.getParserHandler() ); } return xsomParser.getResult(); }
/** * Parses a set of schemas inside a WSDL file. * * A WSDL file may contain multiple {@code <xsd:schema>} elements. */ private XSSchemaSet loadWSDL() throws SAXException { // build DOMForest just like we handle XML Schema DOMForest forest = buildDOMForest( new XMLSchemaInternalizationLogic() ); DOMForestScanner scanner = new DOMForestScanner(forest); XSOMParser xsomParser = createXSOMParser( forest ); // find <xsd:schema>s and parse them individually for( InputSource grammar : opt.getGrammars() ) { Document wsdlDom = forest.get( grammar.getSystemId() ); if (wsdlDom == null) { String systemId = Options.normalizeSystemId(grammar.getSystemId()); if (forest.get(systemId) != null) { grammar.setSystemId(systemId); wsdlDom = forest.get( grammar.getSystemId() ); } } NodeList schemas = wsdlDom.getElementsByTagNameNS(XMLConstants.W3C_XML_SCHEMA_NS_URI,"schema"); for( int i=0; i<schemas.getLength(); i++ ) scanner.scan( (Element)schemas.item(i), xsomParser.getParserHandler() ); } return xsomParser.getResult(); }
/** * Parses a set of schemas inside a WSDL file. * * A WSDL file may contain multiple {@code <xsd:schema>} elements. */ private XSSchemaSet loadWSDL() throws SAXException { // build DOMForest just like we handle XML Schema DOMForest forest = buildDOMForest( new XMLSchemaInternalizationLogic() ); DOMForestScanner scanner = new DOMForestScanner(forest); XSOMParser xsomParser = createXSOMParser( forest ); // find <xsd:schema>s and parse them individually for( InputSource grammar : opt.getGrammars() ) { Document wsdlDom = forest.get( grammar.getSystemId() ); if (wsdlDom == null) { String systemId = Options.normalizeSystemId(grammar.getSystemId()); if (forest.get(systemId) != null) { grammar.setSystemId(systemId); wsdlDom = forest.get( grammar.getSystemId() ); } } NodeList schemas = wsdlDom.getElementsByTagNameNS(XMLConstants.W3C_XML_SCHEMA_NS_URI,"schema"); for( int i=0; i<schemas.getLength(); i++ ) scanner.scan( (Element)schemas.item(i), xsomParser.getParserHandler() ); } return xsomParser.getResult(); }
/** * Parses a set of schemas inside a WSDL file. * * A WSDL file may contain multiple {@code <xsd:schema>} elements. */ private XSSchemaSet loadWSDL() throws SAXException { // build DOMForest just like we handle XML Schema DOMForest forest = buildDOMForest( new XMLSchemaInternalizationLogic() ); DOMForestScanner scanner = new DOMForestScanner(forest); XSOMParser xsomParser = createXSOMParser( forest ); // find <xsd:schema>s and parse them individually for( InputSource grammar : opt.getGrammars() ) { Document wsdlDom = forest.get( grammar.getSystemId() ); if (wsdlDom == null) { String systemId = Options.normalizeSystemId(grammar.getSystemId()); if (forest.get(systemId) != null) { grammar.setSystemId(systemId); wsdlDom = forest.get( grammar.getSystemId() ); } } NodeList schemas = wsdlDom.getElementsByTagNameNS(XMLConstants.W3C_XML_SCHEMA_NS_URI,"schema"); for( int i=0; i<schemas.getLength(); i++ ) scanner.scan( (Element)schemas.item(i), xsomParser.getParserHandler() ); } return xsomParser.getResult(); }
/** * Parses a RELAX NG grammar into an annotated grammar. */ private Model loadRELAXNG() throws SAXException { // build DOM forest final DOMForest forest = buildDOMForest( new RELAXNGInternalizationLogic() ); // use JAXP masquerading to validate the input document. // DOMForest -> ExtensionBindingChecker -> RNGOM XMLReaderCreator xrc = new XMLReaderCreator() { public XMLReader createXMLReader() { // foreset parser cannot change the receivers while it's working, // so we need to have one XMLFilter that works as a buffer XMLFilter buffer = new XMLFilterImpl() { public void parse(InputSource source) throws IOException, SAXException { forest.createParser().parse( source, this, this, this ); } }; XMLFilter f = new ExtensionBindingChecker(Const.RELAXNG_URI,opt,errorReceiver); f.setParent(buffer); f.setEntityResolver(opt.entityResolver); return f; } }; Parseable p = new SAXParseable( opt.getGrammars()[0], errorReceiver, xrc ); return loadRELAXNG(p); }
/** * Parses a RELAX NG grammar into an annotated grammar. */ private Model loadRELAXNG() throws SAXException { // build DOM forest final DOMForest forest = buildDOMForest( new RELAXNGInternalizationLogic() ); // use JAXP masquerading to validate the input document. // DOMForest -> ExtensionBindingChecker -> RNGOM XMLReaderCreator xrc = new XMLReaderCreator() { public XMLReader createXMLReader() { // foreset parser cannot change the receivers while it's working, // so we need to have one XMLFilter that works as a buffer XMLFilter buffer = new XMLFilterImpl() { public void parse(InputSource source) throws IOException, SAXException { forest.createParser().parse( source, this, this, this ); } }; XMLFilter f = new ExtensionBindingChecker(Const.RELAXNG_URI,opt,errorReceiver); f.setParent(buffer); f.setEntityResolver(opt.entityResolver); return f; } }; Parseable p = new SAXParseable( opt.getGrammars()[0], errorReceiver, xrc ); return loadRELAXNG(p); }
for (InputSource value : opt.getGrammars()) reader.parse(value);
/** * Parses a set of XML Schema files into an annotated grammar. */ public XSSchemaSet loadXMLSchema() throws SAXException { if( opt.strictCheck && !SchemaConstraintChecker.check(opt.getGrammars(),errorReceiver,opt.entityResolver)) { // schema error. error should have been reported return null; } if(opt.getBindFiles().length==0) { // no external binding. try the speculative no DOMForest execution, // which is faster if the speculation succeeds. try { return createXSOMSpeculative(); } catch( SpeculationFailure _ ) { // failed. go the slow way } } // the default slower way is to parse everything into DOM first. // so that we can take external annotations into account. DOMForest forest = buildDOMForest( new XMLSchemaInternalizationLogic() ); return createXSOM(forest, scdBasedBindingSet); }
/** * Parses a set of XML Schema files into an annotated grammar. */ public XSSchemaSet loadXMLSchema() throws SAXException { if( opt.strictCheck && !SchemaConstraintChecker.check(opt.getGrammars(),errorReceiver,opt.entityResolver)) { // schema error. error should have been reported return null; } if(opt.getBindFiles().length==0) { // no external binding. try the speculative no DOMForest execution, // which is faster if the speculation succeeds. try { return createXSOMSpeculative(); } catch( SpeculationFailure _ ) { // failed. go the slow way } } // the default slower way is to parse everything into DOM first. // so that we can take external annotations into account. DOMForest forest = buildDOMForest( new XMLSchemaInternalizationLogic() ); return createXSOM(forest, scdBasedBindingSet); }
/** * Parses a set of XML Schema files into an annotated grammar. */ public XSSchemaSet loadXMLSchema() throws SAXException { if( opt.strictCheck && !SchemaConstraintChecker.check(opt.getGrammars(),errorReceiver,opt.entityResolver, opt.disableXmlSecurity)) { // schema error. error should have been reported return null; } if(opt.getBindFiles().length==0) { // no external binding. try the speculative no DOMForest execution, // which is faster if the speculation succeeds. try { return createXSOMSpeculative(); } catch( SpeculationFailure e) { // failed. go the slow way } } // the default slower way is to parse everything into DOM first. // so that we can take external annotations into account. DOMForest forest = buildDOMForest( new XMLSchemaInternalizationLogic() ); return createXSOM(forest, scdBasedBindingSet); }
/** * Parses a set of XML Schema files into an annotated grammar. */ public XSSchemaSet loadXMLSchema() throws SAXException { if( opt.strictCheck && !SchemaConstraintChecker.check(opt.getGrammars(),errorReceiver,opt.entityResolver, opt.disableXmlSecurity)) { // schema error. error should have been reported return null; } if(opt.getBindFiles().length==0) { // no external binding. try the speculative no DOMForest execution, // which is faster if the speculation succeeds. try { return createXSOMSpeculative(); } catch( SpeculationFailure e) { // failed. go the slow way } } // the default slower way is to parse everything into DOM first. // so that we can take external annotations into account. DOMForest forest = buildDOMForest( new XMLSchemaInternalizationLogic() ); return createXSOM(forest, scdBasedBindingSet); }
/** * Parses a set of XML Schema files into an annotated grammar. */ public XSSchemaSet loadXMLSchema() throws SAXException { if( opt.strictCheck && !SchemaConstraintChecker.check(opt.getGrammars(),errorReceiver,opt.entityResolver, opt.disableXmlSecurity)) { // schema error. error should have been reported return null; } if(opt.getBindFiles().length==0) { // no external binding. try the speculative no DOMForest execution, // which is faster if the speculation succeeds. try { return createXSOMSpeculative(); } catch( SpeculationFailure e) { // failed. go the slow way } } // the default slower way is to parse everything into DOM first. // so that we can take external annotations into account. DOMForest forest = buildDOMForest( new XMLSchemaInternalizationLogic() ); return createXSOM(forest, scdBasedBindingSet); }