/** * Convenience method for creating an instance of the schema for this configuration. * * @return The schema for this configuration. * @deprecated use {@link #getXSD()} and {@link XSD#getSchema()}. */ public XSDSchema schema() { try { return getXSD().getSchema(); } catch (IOException e) { throw new RuntimeException(e); } }
/** * Convenience method for creating an instance of the schema for this configuration. * * @return The schema for this configuration. * @deprecated use {@link #getXSD()} and {@link XSD#getSchema()}. */ public XSDSchema schema() { try { return getXSD().getSchema(); } catch (IOException e) { throw new RuntimeException(e); } }
/** * Creates the schema, returning <code>null</code> if the schema could not be created. * </p> * <code>namespaceURI</code> should not be <code>null</code>. All other parameters are ignored. * * @see XSDSchemaLocator#locateSchema(org.eclipse.xsd.XSDSchema, java.lang.String, java.lang.String, java.lang.String) */ public XSDSchema locateSchema(XSDSchema schema, String namespaceURI, String rawSchemaLocationURI, String resolvedSchemaLocationURI) { if (canHandle(schema,namespaceURI,rawSchemaLocationURI,resolvedSchemaLocationURI)) { try { return xsd.getSchema(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Error occured getting schema", e); } } return null; }
/** * Creates the schema, returning <code>null</code> if the schema could not be created. * </p> * <code>namespaceURI</code> should not be <code>null</code>. All other parameters are ignored. * * @see XSDSchemaLocator#locateSchema(org.eclipse.xsd.XSDSchema, java.lang.String, java.lang.String, java.lang.String) */ public XSDSchema locateSchema(XSDSchema schema, String namespaceURI, String rawSchemaLocationURI, String resolvedSchemaLocationURI) { if (xsd.getNamespaceURI().equals(namespaceURI)) { try { return xsd.getSchema(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Error occured getting schema", e); } } return null; }
/** * Encodes an object, element name pair. * * @param object The object to encode. * @param element The name of the element to encode. * * @return The object encoded. * @throws Exception */ protected Document encode(Object object, QName element) throws Exception { Configuration configuration = createConfiguration(); XSDSchema schema = configuration.getXSD().getSchema(); Encoder encoder = new Encoder(configuration, schema); ByteArrayOutputStream output = new ByteArrayOutputStream(); encoder.write(object, element, output); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); return dbf.newDocumentBuilder().parse(new ByteArrayInputStream(output.toByteArray())); }
XSDSchema schema = configuration.getXSD().getSchema();
schemas = new XSDSchema[] { config.getXSD().getSchema() }; } catch (IOException e) { throw (SAXException) new SAXException().initCause(e);