Examples of XSDSchema


Examples of org.eclipse.xsd.XSDSchema

            // don't build schemas for disabled feature types
            if(!meta.enabled())
                continue;

            //build the schema for the types in the single namespace
            XSDSchema schema = build(new FeatureTypeInfo[] { meta }, null);

            //declare the namespace
            String prefix = meta.getNamespace().getPrefix();
            String namespaceURI = meta.getNamespace().getURI();
            wfsSchema.getQNamePrefixToNamespaceMap().put(prefix, namespaceURI);

            //add the types + elements to the wfs schema
            for (Iterator t = schema.getTypeDefinitions().iterator(); t.hasNext();) {
                wfsSchema.getTypeDefinitions().add(t.next());
            }

            for (Iterator e = schema.getElementDeclarations().iterator(); e.hasNext();) {
                wfsSchema.getElementDeclarations().add(e.next());
            }
           
            // add secondary namespaces from catalog
            for (Map.Entry entry : (Set<Map.Entry>) schema.getQNamePrefixToNamespaceMap()
                    .entrySet()) {
                if (!wfsSchema.getQNamePrefixToNamespaceMap().containsKey(entry.getKey())) {
                    wfsSchema.getQNamePrefixToNamespaceMap().put(entry.getKey(), entry.getValue());
                }
            }
View Full Code Here

Examples of org.eclipse.xsd.XSDSchema

                    }
                    return null;
                }
            });
           
            XSDSchema ftSchema = null;
            try {
                ftSchema = Schemas.parse(schemaFile.getAbsolutePath(), locators, resolvers);
            } catch (IOException e) {
                logger.log(Level.WARNING,
                    "Unable to parse schema: " + schemaFile.getAbsolutePath(), e);
            }

            if (ftSchema != null) {
                //respect the prefix (xs vs xsd) given by the underlying schema file
                if ( ftSchema.getSchemaForSchemaQNamePrefix() != null ) {
                    schema.setSchemaForSchemaQNamePrefix(ftSchema.getSchemaForSchemaQNamePrefix());
                }
               
                //add the contents of this schema to the schema being built
                //look up the complex type
                List contents = ftSchema.getContents();

                //ensure that an element for the feature is present
                boolean hasElement = false;
               
                for (Iterator i = contents.iterator(); i.hasNext();) {
                    XSDSchemaContent content = (XSDSchemaContent) i.next();
                    content.setElement(null);
                   
                    //check for import of gml, skip over since we already imported it
                    if ( content instanceof XSDImport ) {
                        XSDImport imprt = (XSDImport) content;
                        if ( gmlNamespace.equals( imprt.getNamespace() ) ) {
                            i.remove();
                        }
                    }
                   
                    //check for duplicated elements and types
                   
                    if ( content instanceof XSDElementDeclaration ) {
                        if ( contains( (XSDNamedComponent) content, schema.getElementDeclarations() ) ) {
                            i.remove();
                        }
                    }
                    else if ( content instanceof XSDTypeDefinition ) {
                        if ( contains( (XSDNamedComponent) content, schema.getTypeDefinitions() ) ) {
                            i.remove();
                        }
                    }
                   
                    // check for element
                    if ( !hasElement && content instanceof XSDElementDeclaration ) {
                        XSDElementDeclaration element = (XSDElementDeclaration) content;
                        if ( name.equals( element.getName() ) &&
                            featureTypeMeta.getNamespace().getURI().equals( element.getTargetNamespace() ) ) {
                            hasElement = true;
                        }
                    }
                }
               
                if ( !hasElement ) {
                    //need to create an element declaration in the schema
                    XSDElementDeclaration element = factory.createXSDElementDeclaration();
                    element.setName( featureTypeMeta.getName() );
                    element.setTargetNamespace( featureTypeMeta.getNamespace().getURI() );
                    element.setSubstitutionGroupAffiliation(
                        schema.resolveElementDeclaration(gmlNamespace, substitutionGroup));
                   
                    //find the type of the element
                    List<XSDComplexTypeDefinition> candidates = new ArrayList<XSDComplexTypeDefinition>();
                    for ( Iterator t = ftSchema.getTypeDefinitions().iterator(); t.hasNext(); ) {
                        XSDTypeDefinition type = (XSDTypeDefinition) t.next();
                        if ( type instanceof XSDComplexTypeDefinition ) {
                            XSDTypeDefinition base = type.getBaseType();
                            while(base != null ) {
                                if ( baseType.equals(base.getName())
View Full Code Here

Examples of org.eclipse.xsd.XSDSchema

     * Note that unlike the input schema there are no global elements and no global types.
     * If possible the returned schema should look like this, but it will at least be valid.
     * @return a schema built accordingly
     */
    public String createYAWLSchema(Instruction[] instructions, String rootElementName) throws YSchemaBuildingException {
        XSDSchema schema = null;
        if (null == _xsd4YAWLBuilder) {
            throwException();
        }
        String[][] desiredNamesToTypes = convertFormat(instructions);
        Set originalComponents = getComponentsNeeded(instructions);
View Full Code Here

Examples of org.eclipse.xsd.XSDSchema

     * Returns a string representation of the primary schema set into this object.
     * @return schema in string format.
     */
    public String getSchemaString() {
        if (null != _xsd4YAWLBuilder) {
            XSDSchema schema = _xsd4YAWLBuilder.getOriginalSchema();
            if (null != schema) {
                String schemaStr = XSDUtil.convertToString(schema);
                schemaStr = schemaStr.substring(schemaStr.indexOf('\n'));
                return schemaStr;
            }
View Full Code Here

Examples of org.eclipse.xsd.XSDSchema

    public String getSchemaLocation() {
        return getClass().getResource("wfsv.xsd").toString();
    }
   
    protected XSDSchema buildSchema() throws IOException {
        XSDSchema wfsvSchema = super.buildSchema();
        wfsvSchema = wfs.getSchemaBuilder().addApplicationTypes(wfsvSchema);
        return wfsvSchema;
    }
View Full Code Here

Examples of org.eclipse.xsd.XSDSchema

            //schema file found, parse it and lookup the complex type
            List locators = new ArrayList();
            for ( XSD xsd : wfs.getAllDependencies() ) {
                locators.add( xsd.createSchemaLocator() );
            }
            XSDSchema ftSchema = null;

            try {
                ftSchema = Schemas.parse(schemaFile.getAbsolutePath(), locators, null);
            } catch (IOException e) {
                LOGGER.log(Level.WARNING,
                    "Unable to parse schema: " + schemaFile.getAbsolutePath(), e);
            }

            if (ftSchema != null) {
                //add the contents of this schema to the schema being built
                //look up the complex type
                List contents = ftSchema.getContents();

                for (Iterator i = contents.iterator(); i.hasNext();) {
                    XSDSchemaContent content = (XSDSchemaContent) i.next();
                    content.setElement(null);
                }
View Full Code Here

Examples of org.eclipse.xsd.XSDSchema

            builder = new VersionedSchemaBuilder(wfs.getGeoServer(), configuration);
        } else {
            builder = new FeatureTypeSchemaBuilder.GML3(wfs.getGeoServer());
        }

        XSDSchema schema = builder.build(results.getFeatureTypeInfo(), req.getBaseUrl());

        // serialize
        schema.updateElement();
        XSDResourceImpl.serialize(output, schema.getElement());
    }
View Full Code Here

Examples of org.eclipse.xsd.XSDSchema

    public String getSchemaLocation() {
        return getClass().getResource("WFS-versioning.xsd").toString();
    }
   
    protected XSDSchema buildSchema() throws IOException {
        XSDSchema wfsvSchema = super.buildSchema();
        wfsvSchema = wfs.getSchemaBuilder().addApplicationTypes(wfsvSchema);
        return wfsvSchema;
    }
View Full Code Here

Examples of org.eclipse.xsd.XSDSchema

    public void testBuildGml2() throws Exception {
        FeatureTypeSchemaBuilder builder = new FeatureTypeSchemaBuilder.GML2(
                getGeoServer());

        FeatureTypeInfo lines = getFeatureTypeInfo(MockData.LINES);
        XSDSchema schema = builder.build(new FeatureTypeInfo[] { lines }, null);

        assertNotNull(schema);
        XSDElementDeclaration element = Schemas.getElementDeclaration(schema,
                MockData.LINES);
        assertNotNull(element);
View Full Code Here

Examples of org.eclipse.xsd.XSDSchema

          {
            continue;
          }
         
          el = (XSDSchemaExtensibilityElement) extensibilityElement;
          XSDSchema schema = el.getSchema();
          if (schema != null)
            schema.setSchemaLocation(getURI().toString());
        }
      }
    }

    if (progressMonitor != null)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.