Package org.geotools.xml.schema

Examples of org.geotools.xml.schema.Schema


          try{
              assertNotNull("Schema missing", contentHandler.getSchema());
              System.out.println(contentHandler.getSchema());
             

            Schema schema = contentHandler.getSchema();
           
            assertTrue("Should only have 2 elements, had "+schema.getElements().length,schema.getElements().length == 2);
            assertTrue("Should only have 1 complexType, had "+schema.getComplexTypes().length,schema.getComplexTypes().length == 1);
           
          } catch (Exception e) {
              e.printStackTrace();
              fail(e.toString());
          }
View Full Code Here


  }

  public void testSimple() throws Exception {
    InputStream in = TestData.openStream("xml/feature-type-simple.xsd");
    try{
          Schema schema = SchemaFactory.getInstance(null, in);
          SimpleFeatureType ft = WFS_1_0_0_DataStore.parseDescribeFeatureTypeResponse("WATER", schema);
          assertNotNull(ft);
          assertEquals(Integer.class, ft.getDescriptor("ID").getType().getBinding());
          assertEquals(String.class, ft.getDescriptor("CODE").getType().getBinding());
          assertEquals(Float.class, ft.getDescriptor("KM").getType().getBinding());
View Full Code Here

  }

  public void testChoiceGeom() throws Exception {
    InputStream in = TestData.openStream("xml/feature-type-choice.xsd");
    try{
          Schema schema = SchemaFactory.getInstance(null, in);
          SimpleFeatureType ft = WFS_1_0_0_DataStore.parseDescribeFeatureTypeResponse("WATER", schema);
          assertNotNull(ft);
          assertEquals(Integer.class, ft.getDescriptor("ID").getType().getBinding());
          assertEquals(String.class, ft.getDescriptor("CODE").getType().getBinding());
          assertEquals(Float.class, ft.getDescriptor("KM").getType().getBinding());
View Full Code Here

            // find element definition
            // should exist when original from a WFS ...
            SimpleFeature f = a.getFeature();
            SimpleFeatureType featureType = f.getFeatureType();
            Name name = featureType.getName();           
            Schema schema = SchemaFactory.getInstance( name.getNamespaceURI() );
            Element[] els = schema.getElements();
            Element e = null;

            if (els != null) {
                for (int i = 0; i < els.length; i++){
                  String typeName = featureType.getTypeName();
View Full Code Here

        if (hc == null) {
            return null;
        }

        InputStream is = protocolHandler.getConnectionFactory().getInputStream(hc);
        Schema schema;
        try {
            schema = SchemaFactory.getInstance(null, is);
        } finally {
            is.close();
        }
View Full Code Here

        osw.flush();
        osw.close();
        InputStream is = protocolHandler.getConnectionFactory().getInputStream(hc);

        Schema schema;
        try {
            schema = SchemaFactory.getInstance(null, is);
        } finally {
            is.close();
        }
View Full Code Here

    // set the namespace and the prefix
    String namespaceURI = ft.getName().getNamespaceURI();
    tx.getFeatureTypeNamespaces().declareNamespace(ft, "wps", namespaceURI);
   
    // also work-around, get the schema of the featureType
    Schema s = SchemaFactory.getInstance(namespaceURI);
   
    // define a schemaLocation and allow thereby validation!
    tx.addSchemaLocation(namespaceURI, s.getURI().toASCIIString());
   
    tx.transform(fc, out);
    // transformExample2 end
}
View Full Code Here

            while( it.hasNext() ) {
                IncludeHandler inc = (IncludeHandler) it.next();
                logger.finest("compressing include " + inc.getSchemaLocation());

                if (inc != null && inc.getSchemaLocation() != null) {
                    Schema cs;
                    URI incURI = null;
                    if (thisURI == null) {
                        try {
                            incURI = new URI(inc.getSchemaLocation());
                        } catch (URISyntaxException e) {
                            logger.warning(e.getMessage());
                        }
                    } else {
                        incURI = thisURI.normalize().resolve(inc.getSchemaLocation());
                    }
                    cs = SchemaFactory.getInstance(targetNamespace, incURI, logger.getLevel());

                    if (uri != null) {
                        uri = incURI.resolve(uri);
                    } else {
                        uri = incURI;
                    }

                    // already compressed
                    addSchema(cs);
                }
            }
        }

        includes = null;

        // imports may be schema or schemaHandler
        if (this.imports != null) {
            // have now loaded the included stuff.
            LinkedList imports1 = new LinkedList();
            it = this.imports.iterator();

            while( it.hasNext() ) {
                Object obj = it.next();

                if (obj instanceof ImportHandler) {
                    ImportHandler imp = (ImportHandler) obj;
                    URI incURI = null;

                    // if ((imp.getSchemaLocation() != null) && (thisURI != null)) {
                    // incURI = thisURI.normalize().resolve(imp
                    // .getSchemaLocation());
                    // }
                    // fix from chris dillard
                    if (imp.getSchemaLocation() != null) {
                        if (thisURI != null) {
                            // For resolving relative URIs
                            incURI = thisURI.normalize().resolve(imp.getSchemaLocation());
                        } else {
                            // If thisURI is null, we have to assume the
                            // URI is absolute.
                            incURI = imp.getSchemaLocation();
                        }
                    }

                    Schema cs = SchemaFactory.getInstance(imp.getNamespace(), incURI, logger.getLevel());

                    imports1.add(cs);
                } else {
                    imports1.add(obj);
                }
View Full Code Here

                return lookUpSimpleType(localName, schema, new TreeSet());
        } else {
            if (imports != null) {
                it = imports.iterator();
                while( it.hasNext() ) {
                    Schema s = (Schema) it.next();
                    String ns = s.getTargetNamespace().toString();

                    String prefixLookup = prefixCache != null ? (String) prefixCache.get(ns) : null;
                    if (prefix1 == null || prefixLookup == null || prefix1.equals(prefixLookup)) {
                        SimpleType st = lookUpSimpleType(localName, s, new TreeSet());
                        if (st != null) {
View Full Code Here

                return lookUpComplexType(localName, schema, new TreeSet());
        } else {
            if (imports != null) {
                it = imports.iterator();
                while( it.hasNext() ) {
                    Schema s = (Schema) it.next();
                    String ns = s.getTargetNamespace().toString();
                    String prefixLookup = prefixCache != null ? (String) prefixCache.get(ns) : null;
                    if (prefix1 == null || prefixLookup == null || prefix1.equals(prefixLookup)) {
                        ComplexType ct = lookUpComplexType(localName, s, new TreeSet());
                        if (ct != null) {
                            return ct;
View Full Code Here

TOP

Related Classes of org.geotools.xml.schema.Schema

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.