/** * @return The namespace of the configuration schema. */ public final String getNamespaceURI() { return getXSD().getNamespaceURI(); }
/** * @return The namespace of the configuration schema. */ public final String getNamespaceURI() { return getXSD().getNamespaceURI(); }
/** * Returns the url to the file definiing hte schema. * <p> * For schema which are defined by multiple files, this method should return the base schema * which includes all other files that define the schema. * </p> * @deprecated use {@link XSD#getSchemaLocation()}. */ public final String getSchemaFileURL() { return getXSD().getSchemaLocation(); }
/** * 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); } }
/** * Returns the url to the file definiing hte schema. * <p> * For schema which are defined by multiple files, this method should return the base schema * which includes all other files that define the schema. * </p> * @deprecated use {@link XSD#getSchemaLocation()}. */ public final String getSchemaFileURL() { return getXSD().getSchemaLocation(); }
/** * 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); } }
/** * 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();
/** * Test that a schema known to be in the catalog is resolved to the expected local file. */ @Test public void testCatalogSchemaResolution() throws Exception { URL catalogLocation = getClass().getResource(schemaBase + "mappedPolygons.oasis.xml"); String namespace = "http://www.cgi-iugs.org/xml/GeoSciML/2"; String schemaLocation = "http://schemas.opengis.net/GeoSciML/geosciml.xsd"; Configuration config = new AppSchemaConfiguration(namespace, schemaLocation, new AppSchemaResolver(AppSchemaCatalog.build(catalogLocation))); String resolvedSchemaLocation = config.getXSD().getSchemaLocation(); assertTrue(resolvedSchemaLocation.startsWith("file:/")); assertTrue(resolvedSchemaLocation.endsWith(schemaBase + "commonSchemas_new/GeoSciML/geosciml.xsd")); } }
schemas = new XSDSchema[] { config.getXSD().getSchema() }; } catch (IOException e) { throw (SAXException) new SAXException().initCause(e);