Package org.geotools.xml

Examples of org.geotools.xml.SchemaIndex


     *
     * @throws Exception
     */
    @Test
    public void testParseSchema() throws Exception {
        SchemaIndex schemaIndex;
        try {
            // loadSchema(schemaBase + "commonSchemas_new/GeoSciML/Gsml.xsd");
            // use the absolute URL and let the Oasis Catalog resolve it to the local FS
            schemaIndex = loadSchema("http://schemas.opengis.net/GeoSciML/Gsml.xsd");
        } catch (Exception e) {
View Full Code Here


     *
     * @throws Exception
     */
    @Test
    public void testParseSchema() throws Exception {
        SchemaIndex schemaIndex;
        try {
            String schemaLocation = schemaBase + "commonSchemas_new/awdip.xsd";
            URL location = getClass().getResource(schemaLocation);
            assertNotNull(location);
            schemaIndex = loadSchema(location);
View Full Code Here

    @Test
    public void testParseSimpleFeatureType() throws Exception {
        String res = "/test-data/simpleFeature.xsd";
        URL resource = getClass().getResource(res);

        SchemaIndex schemaIndex = EmfAppSchemaReader.newInstance().parse(resource);

        AppSchemaFeatureTypeRegistry parsedTypes = new AppSchemaFeatureTypeRegistry();
       
        try {
            parsedTypes.addSchemas(schemaIndex);
View Full Code Here

    @Test
    public void testComplexFeatureType() throws Exception {
        String res = "/test-data/complexFeature.xsd";
        URL resource = getClass().getResource(res);
        SchemaIndex schemaIndex = EmfAppSchemaReader.newInstance().parse(resource);
       
        AppSchemaFeatureTypeRegistry typeRegistry = new AppSchemaFeatureTypeRegistry();
        try {
            typeRegistry.addSchemas(schemaIndex);
           
View Full Code Here

    @Test
    public void testSimpleAttributeFromComplexDeclaration() throws Exception {
        String res = "/test-data/complexFeature.xsd";
        URL resource = getClass().getResource(res);
        SchemaIndex schemaIndex = EmfAppSchemaReader.newInstance().parse(resource);

        AppSchemaFeatureTypeRegistry registry = new AppSchemaFeatureTypeRegistry();
        try {
            registry.addSchemas(schemaIndex);
   
View Full Code Here

    public DocumentHandler createDocumentHandler(ParserHandler parser) {
        return new DocumentHandlerImpl(this, parser);
    }

    public ElementHandler createElementHandler(QName qName, Handler parent, ParserHandler parser) {
        SchemaIndex index = parser.getSchemaIndex();

        //look up the element in the schema
        XSDElementDeclaration element = index.getElementDeclaration(qName);

        if (element != null) {
            return createElementHandler(element, parent, parser);
        }
View Full Code Here

                    org.geotools.gml3.v3_2.GMLConfiguration.class);
        }
    };

    public static Configuration findGmlConfiguration(AppSchemaConfiguration configuration) {
        SchemaIndex index = null;
        try {
            index = Schemas.findSchemas(configuration);
            for (QName name : SUPPORTED_GML_KNOWN_TYPE_TO_CONFIGURATION_MAP.keySet()) {
                XSDTypeDefinition type = index.getTypeDefinition(name);
                if (type != null) {
                    try {
                        return SUPPORTED_GML_KNOWN_TYPE_TO_CONFIGURATION_MAP.get(name)
                                .newInstance();
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                }
            }
            for (XSDSchema schema : index.getSchemas()) {
                String ns = schema.getTargetNamespace();
                if (ns != null && ns.startsWith("http://www.opengis.net/gml")) {
                    throw new RuntimeException("Unsupported GML version for schema at "
                            + configuration.getSchemaLocation());
                }
            }
        } finally {
            if (index != null) {
                index.destroy();
            }
        }
        return null;
    }
View Full Code Here

            nameSpace = schemaParser.findSchemaNamespace(schemaUrl);
            schemaLocation = schemaUrl.toExternalForm();
            schemaURIs.put(nameSpace, schemaLocation);

            SchemaIndex schemaIndex = schemaParser.parse(nameSpace, schemaLocation);
            // add the resolved EMF schema so typeRegistry can find the needed type tree when it's
            // asked for the mapped FeatureType
            typeRegistry.addSchemas(schemaIndex);
        }
    }
View Full Code Here

     *
     * @throws Exception
     */
    @Test
    public void testPolymorphism() throws Exception {
        SchemaIndex schemaIndex = loadSchema("http://schemas.opengis.net/GeoSciML/Gsml.xsd");

        AppSchemaFeatureTypeRegistry typeRegistry = new AppSchemaFeatureTypeRegistry();
       
        try {
            typeRegistry.addSchemas(schemaIndex);
View Full Code Here

        }

        context.registerComponentInstance(namespaces);
        context.registerComponentInstance(new NamespaceSupportWrapper(namespaces));
       
        SchemaIndex index = new SchemaIndexImpl( new XSDSchema[]{configuration.schema()} );
        context.registerComponentInstance(index);
       
        context.registerComponentInstance(configuration);
       
        return bindingLoader.loadBinding(name, context);
View Full Code Here

TOP

Related Classes of org.geotools.xml.SchemaIndex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.