@Override public void info(SAXParseException exception) { if(opt.verbose) super.info(exception); } @Override
public void warning(SAXParseException exception) { hadWarning[0] = true; if(!opt.quiet) super.warning(exception); } @Override
public ModelLoader(Options _opt, JCodeModel _codeModel, ErrorReceiver er) { this.opt = _opt; this.codeModel = _codeModel; this.errorReceiver = new ErrorReceiverFilter(er); }
/** * Checks the correctness of the XML Schema documents and return true * if it's OK. * * <p> * This method performs a weaker version of the tests where error messages * are provided without line number information. So whenever possible * use {@link SchemaConstraintChecker}. * * @see SchemaConstraintChecker */ public boolean checkSchemaCorrectness(ErrorReceiver errorHandler) { try { SchemaFactory sf = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI); ErrorReceiverFilter filter = new ErrorReceiverFilter(errorHandler); sf.setErrorHandler(filter); Set<String> roots = getRootDocuments(); Source[] sources = new Source[roots.size()]; int i=0; for (String root : roots) { sources[i++] = new DOMSource(get(root),root); } sf.newSchema(sources); return !filter.hadError(); } catch (SAXException e) { // the errors should have been reported return false; } }
errorReceiver.pollAbort(); forest.parse(value, true); errorReceiver.pollAbort(); Document dom = forest.parse(value, true); if(dom==null) continue; // error must have been reported errorReceiver.error(new SAXParseException(Messages.format(Messages.ERR_NOT_A_BINDING_FILE, root.getNamespaceURI(), root.getLocalName()),
public void error(SAXParseException e) throws SAXException { errorReceiver.error(e); }
ErrorReceiverFilter ehf = new ErrorReceiverFilter(receiver); ehf.error( p.locator, Messages.format( p.element.getNodeName() )); ehf.error( c.getOwner().getLocator(), Messages.format( if(ehf.hadError()) o = null; return o;
public void fatalError(SAXParseException e) throws SAXException { errorReceiver.fatalError(e); }
public ErrorReceiverFilter( ErrorListener h ) { setErrorReceiver(h); }
/** * Parses a {@link DOMForest} into a {@link XSSchemaSet}. * * @return * null if the parsing failed. */ public XSSchemaSet createXSOM(DOMForest forest, SCDBasedBindingSet scdBasedBindingSet) throws SAXException { // set up other parameters to XSOMParser XSOMParser reader = createXSOMParser(forest); // re-parse the transformed schemas for (String systemId : forest.getRootDocuments()) { errorReceiver.pollAbort(); Document dom = forest.get(systemId); if (!dom.getDocumentElement().getNamespaceURI().equals(Const.JAXB_NSURI)) reader.parse(systemId); } XSSchemaSet result = reader.getResult(); if(result!=null) scdBasedBindingSet.apply(result,errorReceiver); return result; }
public void endDTD() throws SAXException { // bind them all. // we need to know how elements are referencing each other before we do this, // so this can be only done at the endDTD method for( Element e : elements.values() ) e.bind(); // if there was an error by now, just abort. if (errorReceiver.hadError()) return; processInterfaceDeclarations(); // check XJC extensions and realize them model.serialVersionUID = bindInfo.getSerialVersionUID(); if(model.serialVersionUID!=null) model.serializable=true; model.rootClass = bindInfo.getSuperClass(); model.rootInterface = bindInfo.getSuperInterface(); // TODO: do we need to reimplement them? // // performs annotation // Annotator.annotate(model, this); // FieldCollisionChecker.check( model, this ); processConstructorDeclarations(); }
/** * Checks the correctness of the XML Schema documents and return true * if it's OK. * * <p> * This method performs a weaker version of the tests where error messages * are provided without line number information. So whenever possible * use {@link SchemaConstraintChecker}. * * @see SchemaConstraintChecker */ public boolean checkSchemaCorrectness(ErrorReceiver errorHandler) { try { SchemaFactory sf = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI); ErrorReceiverFilter filter = new ErrorReceiverFilter(errorHandler); sf.setErrorHandler(filter); Set<String> roots = getRootDocuments(); Source[] sources = new Source[roots.size()]; int i=0; for (String root : roots) { sources[i++] = new DOMSource(get(root),root); } sf.newSchema(sources); return !filter.hadError(); } catch (SAXException e) { // the errors should have been reported return false; } }
errorReceiver.pollAbort(); forest.parse(value, true); errorReceiver.pollAbort(); Document dom = forest.parse(value, true); if(dom==null) continue; // error must have been reported errorReceiver.error(new SAXParseException(Messages.format(Messages.ERR_NOT_A_BINDING_FILE, root.getNamespaceURI(), root.getLocalName()),
public void error(SAXParseException e) throws SAXException { errorReceiver.error(e); }
public void fatalError(SAXParseException e) throws SAXException { errorReceiver.fatalError(e); }
public ErrorReceiverFilter( ErrorListener h ) { setErrorReceiver(h); }
/** * Parses a {@link DOMForest} into a {@link XSSchemaSet}. * * @return * null if the parsing failed. */ public XSSchemaSet createXSOM(DOMForest forest, SCDBasedBindingSet scdBasedBindingSet) throws SAXException { // set up other parameters to XSOMParser XSOMParser reader = createXSOMParser(forest); // re-parse the transformed schemas for (String systemId : forest.getRootDocuments()) { errorReceiver.pollAbort(); Document dom = forest.get(systemId); if (!dom.getDocumentElement().getNamespaceURI().equals(Const.JAXB_NSURI)) reader.parse(systemId); } XSSchemaSet result = reader.getResult(); if(result!=null) scdBasedBindingSet.apply(result,errorReceiver); return result; }
public void endDTD() throws SAXException { // bind them all. // we need to know how elements are referencing each other before we do this, // so this can be only done at the endDTD method for( Element e : elements.values() ) e.bind(); // if there was an error by now, just abort. if (errorReceiver.hadError()) return; processInterfaceDeclarations(); // check XJC extensions and realize them model.serialVersionUID = bindInfo.getSerialVersionUID(); if(model.serialVersionUID!=null) model.serializable=true; model.rootClass = bindInfo.getSuperClass(); model.rootInterface = bindInfo.getSuperInterface(); // TODO: do we need to reimplement them? // // performs annotation // Annotator.annotate(model, this); // FieldCollisionChecker.check( model, this ); processConstructorDeclarations(); }
ErrorReceiverFilter filter = new ErrorReceiverFilter(errorHandler); sf.setErrorHandler(filter); Set<String> roots = getRootDocuments(); return !filter.hadError(); } catch (SAXException e) {
@Override public void warning(SAXParseException exception) { if (!opt.quiet) super.warning(exception); } };