SchemaCompiler sc = XJC.createSchemaCompiler(); File file = new File("D:\\my-dir\\my-schema.xsd"); sc.setErrorListener(... ); sc.parseSchema(new InputSource(file.toURI().toString())); S2JJAXBModel model = sc.bind(); JCodeModel cm = model.generateCode(null, null); cm.build(new File("."));
compiler.setErrorListener(errorListener); compiler.parseSchema(new InputSource(url.toExternalForm())); S2JJAXBModel model = compiler.bind();
compiler.setErrorListener(errorListener); compiler.parseSchema(new InputSource(url.toExternalForm())); S2JJAXBModel model = compiler.bind();
public SchemaMetadata(DynamicClassLoader dynamicClassLoader, Map<String, Object> properties, Node node, EntityResolver resolver) throws JAXBException { this(dynamicClassLoader, properties); Element element; if (node.getNodeType() == Node.DOCUMENT_NODE) { element = ((Document) node).getDocumentElement(); } else if (node.getNodeType() == Node.ELEMENT_NODE) { element = (Element) node; } else { throw new JAXBException(org.eclipse.persistence.exceptions.JAXBException.cannotInitializeFromNode()); } // Use XJC API to parse the schema and generate its JCodeModel schemaCompiler = XJC.createSchemaCompiler(); schemaCompiler.setEntityResolver(resolver); schemaCompiler.setErrorListener(new XJCErrorListener()); schemaCompiler.parseSchema(DEFAULT_SYSTEM_ID, element); }
schemaCompiler.setErrorListener(er);
schemaCompliler.setErrorListener(new ErrorListener() {
schemaCompiler.setErrorListener(listener);
schemaCompiler.setErrorListener(listener);
if (!parameters.autoPackage) s2j.setDefaultPackageName(parameters.pkg); s2j.setErrorListener(errorListener);
public SchemaMetadata(DynamicClassLoader dynamicClassLoader, Map<String, Object> properties, Source metadataSource, EntityResolver resolver) throws JAXBException { this(dynamicClassLoader, properties); try { InputSource schemaInputSource = createInputSourceFromSource(metadataSource); if (schemaInputSource.getSystemId() == null) { schemaInputSource.setSystemId(DEFAULT_SYSTEM_ID); } // Use XJC API to parse the schema and generate its JCodeModel schemaCompiler = XJC.createSchemaCompiler(); schemaCompiler.setEntityResolver(resolver); schemaCompiler.setErrorListener(new XJCErrorListener()); if (externalBindings != null) { for (InputSource xjbSource : externalBindings) { schemaCompiler.parseSchema(xjbSource); } } schemaCompiler.parseSchema(schemaInputSource); } catch (XMLPlatformException xpe) { // This will occur when trying to refreshMetadata from a closed stream (non-XML Node metadata) if (xpe.getCause() instanceof TransformerException) { TransformerException te = (TransformerException) xpe.getCause(); if (te.getCause() instanceof IOException) { throw org.eclipse.persistence.exceptions.JAXBException.cannotRefreshMetadata(); } } } catch (Exception e) { throw new JAXBException(org.eclipse.persistence.exceptions.JAXBException.errorCreatingDynamicJAXBContext(e)); } }
sc.setErrorListener(new ErrorListener(){ public void error(SAXParseException saxParseException) { log.error(saxParseException.getMessage());
sc.setErrorListener(new ErrorListener(){ public void error(SAXParseException saxParseException) { log.error(saxParseException.getMessage());
.getTargetNamespace())); schemaCompiler.setClassNameAllocator(allocator); schemaCompiler.setErrorListener(this); schemaCompilerGenCode = XJC.createSchemaCompiler(); schemaCompilerGenCode.setClassNameAllocator(allocator); schemaCompilerGenCode.setErrorListener(this);
schemaCompiler.setErrorListener(errReceiver); int schemaElementCount = 1;
schemaCompiler.setErrorListener(errReceiver); int schemaElementCount = 1;
schemaCompiler.setErrorListener(errReceiver); int schemaElementCount = 1;
schemaCompiler.setErrorListener(errReceiver); int schemaElementCount = 1;