Package org.exolab.castor.xml.schema

Examples of org.exolab.castor.xml.schema.Schema


     */
    private void processImportedSchemas(final Schema schema, final SGStateInfo sInfo)
    throws IOException {
        Enumeration<Schema> enumeration = schema.getImportedSchema();
        while (enumeration.hasMoreElements()) {
            Schema importedSchema = enumeration.nextElement();
            if (!_generateImported) {
                LOG.warn("Note: No code will be generated for the following *imported* schema: "
                        + importedSchema.getSchemaLocation() + "; if this is on intention, please "
                        + "do not forget to generate code for this schema as well. Alternatively,"
                        + "consider using the 'generateImportedSchemas' flag.");
                continue;
            }

            _schemasProcessed.add(schema);
            if (!_schemasProcessed.contains(importedSchema)) {
                SGStateInfo importedSInfo  = new SGStateInfo(importedSchema, this);
                String packageName = sInfo.getPackageName();
                importedSInfo.setPackageName(packageName);
               
                //--map the schemaLocation of the imported schema with the packageName defined
                if (packageName != null) {
                    setLocationPackageMapping(importedSchema.getSchemaLocation(), packageName);
                }
               
                generateAllClassFiles(importedSchema, importedSInfo);

                //--'store' the imported JClass instances
View Full Code Here


                throw new BuildException(msg, e);
            } catch (SAXException e) {
                String msg = "Can't parse input file " + source.getSystemId() + ".\n" + e;
                throw new BuildException(msg, e);
            }
            Schema schema = schemaUnmarshaller.getSchema();
            try {
                generateSource(schema, packageName);
            } catch (Exception iox) {
                throw new BuildException(iox);
            }
View Full Code Here

     *
     * @return the schemaLocation of the parent schema of the wrapped structure.
     */
    public String getSchemaLocation() {
        String location = null;
        Schema schema = getSchema();
        if (schema != null)
            location = schema.getSchemaLocation();

        return location;
    }
View Full Code Here

     *
     * @return the targetNamespace of the parent schema of the wrapped structure.
     */
    public String getTargetNamespace() {
        String result = null;
        Schema schema = null;
        Form form = null;
       
        switch (_annotated.getStructureType()) {
            case Structure.ATTRIBUTE:
                AttributeDecl attribute = (AttributeDecl)_annotated;
                //-- resolve reference
                if (attribute.isReference())
                    attribute = attribute.getReference();
               
                schema = attribute.getSchema();
               
                //-- top-level (use targetNamespace of schema)
                if (attribute.getParent() == schema)
                    break;
               
                //-- check form (qualified or unqualified)
                form = attribute.getForm();
                if (form == null) {
                    form = schema.getAttributeFormDefault();
                }
                if ((form == null) || form.isUnqualified()) {
                    //-- no targetNamespace by default
                    return null;
                }
                //-- use targetNamespace of schema
                break;
            case Structure.ELEMENT:
                //--resolve reference?
                ElementDecl element = (ElementDecl)_annotated;
                if (element.isReference())
                    element = element.getReference();
                
                schema = element.getSchema();
                //-- top-level (use targetNamespace of schema)
                if (element.getParent() == schema)
                    break;
               
                //-- check form (qualified or unqualified)
                form = element.getForm();
                if (form == null) {
                    form = schema.getElementFormDefault();
                }
                if ((form == null) || form.isUnqualified()) {
                    //-- no targetNamespace by default
                    return null;
                }
                //-- use targetNamespace of schema
                break;
            case Structure.COMPLEX_TYPE:
                ComplexType complexType = (ComplexType)_annotated;
                schema = complexType.getSchema();
                if (complexType.getParent() == schema)
                    break;
                return null;
            default:
                break;
        }
        if (schema == null)
            schema = getSchema();
        if (schema != null)
            result = schema.getTargetNamespace();
        return result;
    } //-- getTargetNamespace
View Full Code Here

        JClass    jClass    = state.jClass;

        initialize(jClass);

        //-- XML information
        Schema  schema = simpleType.getSchema();
        classInfo.setNamespaceURI(schema.getTargetNamespace());
        classInfo.setNodeName(typeName);

        //-- process annotation
        String comment  = processAnnotations(simpleType);
        if (comment != null)
View Full Code Here

                //-- XXXX *To be added*
            }
        }
        //-- Just return string for now, as all simpleTypes can
        //-- fit into a string
        Schema schema = aType.getSchema();
        return schema.getSimpleType("string",
            schema.getSchemaNamespace());
    }
View Full Code Here

            } catch (IOException e) {
                throw new BuildException("Can't read input file " + source.getSystemId() + ".\n" + e, e);
            } catch (SAXException e) {
                throw new BuildException("Can't parse input file " + source.getSystemId() + ".\n" + e, e);
            }
            Schema schema = schemaUnmarshaller.getSchema();
            generateSource(schema, packageName);
        }
View Full Code Here

     *
     * @return the schemaLocation of the parent schema of the wrapped structure.
     */
    public String getSchemaLocation() {
        String location = null;
        Schema schema = getSchema();
        if (schema != null)
            location = schema.getSchemaLocation();

        return location;
    }
View Full Code Here

     *
     * @return the targetNamespace of the parent schema of the wrapped structure.
     */
    public String getTargetNamespace() {
        String result = null;
        Schema schema = null;
        Form form = null;
       
        switch (_annotated.getStructureType()) {
            case Structure.ATTRIBUTE:
                AttributeDecl attribute = (AttributeDecl)_annotated;
                //-- resolve reference
                if (attribute.isReference())
                    attribute = attribute.getReference();
               
                schema = attribute.getSchema();
               
                //-- top-level (use targetNamespace of schema)
                if (attribute.getParent() == schema)
                    break;
               
                //-- check form (qualified or unqualified)
                form = attribute.getForm();
                if (form == null) {
                    form = schema.getAttributeFormDefault();
                }
                if ((form == null) || form.isUnqualified()) {
                    //-- no targetNamespace by default
                    return null;
                }
                //-- use targetNamespace of schema
                break;
            case Structure.ELEMENT:
                //--resolve reference?
                ElementDecl element = (ElementDecl)_annotated;
                if (element.isReference())
                    element = element.getReference();
                
                schema = element.getSchema();
                //-- top-level (use targetNamespace of schema)
                if (element.getParent() == schema)
                    break;
               
                //-- check form (qualified or unqualified)
                form = element.getForm();
                if (form == null) {
                    form = schema.getElementFormDefault();
                }
                if ((form == null) || form.isUnqualified()) {
                    //-- no targetNamespace by default
                    return null;
                }
                //-- use targetNamespace of schema
                break;
            case Structure.COMPLEX_TYPE:
                ComplexType complexType = (ComplexType)_annotated;
                schema = complexType.getSchema();
                if (complexType.getParent() == schema)
                    break;
                return null;
            default:
                break;
        }
        if (schema == null)
            schema = getSchema();
        if (schema != null)
            result = schema.getTargetNamespace();
        return result;
    } //-- getTargetNamespace
View Full Code Here

            unmarshaller
                = new SimpleTypeRestrictionUnmarshaller(_simpleTypeDef, atts);
        }
        else if (SchemaNames.LIST.equals(name)) {
            foundList = true;
            Schema schema = _simpleTypeDef.getSchema();
            unmarshaller = new SimpleTypeListUnmarshaller(schema, atts);
        }
        else if (SchemaNames.UNION.equals(name)) {
            foundUnion = true;
            Schema schema = _simpleTypeDef.getSchema();
            unmarshaller = new UnionUnmarshaller(schema, atts);
        }
        else illegalElement(name);

    } //-- startElement
View Full Code Here

TOP

Related Classes of org.exolab.castor.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.