Package org.eclipse.xsd

Examples of org.eclipse.xsd.XSDSchema


    }
   
    @Override
    protected XSDSchema buildSchema() throws IOException {
        //check if schema already exists in registry, if so do not build
        XSDSchema schema = AppSchemaXSDRegistry.getInstance().lookUp(schemaLocation);
        if (schema == null) {
            schema = super.buildSchema();
            //register schema
            AppSchemaXSDRegistry.getInstance().register(schema);
        } else {
            //reset because included schema's are not always complete
            schema.reset();
        }
        return schema;
    }
View Full Code Here


            if (resolvedResource != null && resolvedResource instanceof XSDResourceImpl) {
                return ((XSDResourceImpl) resolvedResource).getSchema();
            } else {
                // try getting from registry
                XSDSchema schema = lookUp(resolvedSchemaLocationURI);
                if (schema == null) { // build new one
                    try {
                        // use same resource set to avoid infinite loop
                        schema = Schemas.parse(resolvedSchemaLocationURI, resourceSet);
                        register(schema);
View Full Code Here

                        }
                    }

                    //next check for schema override
                    for (int j = 0; j < locators.size(); j++) {
                        XSDSchema schema = locators.get(j).locateSchema(null, namespace, location, null);

                        if (schema != null) {
                            schemas[i / 2] = schema;

                            break;
                        }
                    }

                    //if no schema override was found, parse location directly
                    if (schemas[i / 2] == null) {
                        //validate the schema location
                        if ( isValidating() ) {
                            try {
                                Schemas.validateImportsIncludes(location,locators,resolvers);
                            }
                            catch (IOException e) {
                                throw (SAXException) new SAXException( "error validating" ).initCause(e);
                            }   
                        }
                       
                        //parse the document
                        try {
                            schemas[i / 2] = Schemas.parse(location, locators, resolvers, uriHandlers);
                        } catch (Exception e) {
                            String msg = "Error parsing: " + location;
                            logger.warning(msg);

                            if (isStrict()) {
                                //strict mode, throw exception
                                throw (SAXException) new SAXException(msg).initCause(e);
                            }
                        }
                    }
                }
            } else {
                //could not find a schemaLocation attribute, use the locators
                //look for schema with locators
                for (int i = 0; i < locators.size(); i++) {
                    XSDSchema schema = locators.get(i).locateSchema(null, uri, null, null);

                    if (schema != null) {
                        schemas = new XSDSchema[] { schema };

                        break;
View Full Code Here

            //set the hint
            configuration.getContext()
                         .registerComponentInstance("http://geotools.org/typeDefinition", type);
        }

        XSDSchema schema = configuration.getXSD().getSchema();

        Encoder encoder = new Encoder(configuration, schema);
       
        //additional namespaces
        for ( Iterator e = namespaceMappings.entrySet().iterator(); e.hasNext(); ) {
View Full Code Here

        HashMap mappings = new HashMap();

        try {
            for (Iterator d = configuration.getXSD().getDependencies().iterator(); d.hasNext();) {
                XSD xsd = (XSD) d.next();
                XSDSchema schema = xsd.getSchema();

                mappings.putAll(schema.getQNamePrefixToNamespaceMap());
            }

            mappings.putAll(configuration.getXSD().getSchema().getQNamePrefixToNamespaceMap());
        } catch (IOException e) {
            throw new RuntimeException(e);
View Full Code Here

            if (LOGGER.isLoggable(Level.FINE)) {
                LOGGER.fine("schema location: " + schemaLocation);
            }

            XSDSchema schema = locator.locateSchema(null, namespaceURI, schemaLocation, null);

            if (schema != null) {
                resolvedSchemas.add(schema);
            }
        }
View Full Code Here

     */
    public static final void dispose(XSDSchema schema) {
        for (XSDSchemaContent content : schema.getContents()) {
            if (content instanceof XSDSchemaDirective) {
                XSDSchemaDirective directive = (XSDSchemaDirective) content;
                XSDSchema resolvedSchema = directive.getResolvedSchema();
               
                if (resolvedSchema != null) {
                    synchronized (Schemas.class) {
                        resolvedSchema.getReferencingDirectives().remove(directive);
                        for (XSDElementDeclaration dec : resolvedSchema.getElementDeclarations()) {
                            if(dec == null) {
                                continue;
                            }
                            List<XSDElementDeclaration> toRemove = new ArrayList<XSDElementDeclaration>();
                            for (XSDElementDeclaration subs : dec.getSubstitutionGroup()) {
View Full Code Here

                    if (!added.contains(imprt.getNamespace())) {
                        imports.add(imprt);
                        added.add(imprt.getNamespace());

                        XSDSchema resolvedSchema = imprt.getResolvedSchema();
                        if(resolvedSchema == null){
                            LOGGER.info("Schema import wasn't resolved: " + imprt.getNamespace()
                                    + " declared location: " + imprt.getSchemaLocation());
                        }else{
                            queue.addLast(resolvedSchema);
View Full Code Here

        public XSDSchema locateSchema(XSDSchema xsdSchema, String namespaceURI,
            String rawSchemaLocationURI, String resolvedSchemaLocationURI) {
            for (int i = 0; i < locators.size(); i++) {
                XSDSchemaLocator locator = (XSDSchemaLocator) locators.get(i);
                XSDSchema schema = locator.locateSchema(xsdSchema, namespaceURI,
                        rawSchemaLocationURI, resolvedSchemaLocationURI);

                if (schema != null) {
                    return schema;
                }
View Full Code Here

        if (!(notification.getNewValue() instanceof XSDSchemaDirective)) {
            return;
        }
       
        XSDSchemaDirective newDirective = (XSDSchemaDirective) notification.getNewValue();
        XSDSchema schema = newDirective.getSchema();
        synchronized (target) {
            ArrayList<Integer> toremove = new ArrayList();
            for (int i = 0; i < target.getReferencingDirectives().size(); i++) {
                XSDSchemaDirective directive =
                    (XSDSchemaDirective) target.getReferencingDirectives().get(i);
                XSDSchema schema2 = directive.getSchema();
                if (schema2 == null) {
                    toremove.add(i);
                    continue;
                }
               
                String ns1 = schema != null ? schema.getTargetNamespace() : null;
                String ns2 = schema2.getTargetNamespace();
               
                if (Utilities.equals(ns1, ns2)) {
                    toremove.add(i);
                }
            }
View Full Code Here

TOP

Related Classes of org.eclipse.xsd.XSDSchema

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.