Package org.exolab.castor.xml.schema

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


            }
        }
              
        if (typeName == null) {
            // not handled by binding file
            Structure parent = simpleType.getParent();
            if (parent instanceof ElementDecl) {
                typeName = ((ElementDecl) parent).getName();
            } else if (parent instanceof AttributeDecl) {
                typeName = ((AttributeDecl) parent).getName();
            }
View Full Code Here


        (ContentModelGroup contentModel, String schemaPrefix)
        throws SAXException
    {
        Enumeration enumeration = contentModel.enumerate();
        while (enumeration.hasMoreElements()) {
            Structure structure = (Structure) enumeration.nextElement();
            switch (structure.getStructureType()) {
                case Structure.ELEMENT:
                    processElement((ElementDecl)structure, schemaPrefix);
                    break;
                case Structure.MODELGROUP:
                case Structure.GROUP:
View Full Code Here

                }
                _schema = group.getSchema();
                group = null;
                break;
            case Structure.GROUP:
                Structure parent = ((Group) _annotated).getParent();
                short structure = parent.getStructureType();
                while (structure == Structure.GROUP) {
                    parent = ((Group) parent).getParent();
                    structure = parent.getStructureType();
                }
                if (structure == Structure.COMPLEX_TYPE) {
                    _schema = ((ComplexType) parent).getSchema();
                } else if (structure == Structure.MODELGROUP) {
                    _schema = ((ModelGroup) parent).getSchema();
View Full Code Here

                         //-- need to do a little counting here.
                         if (!userSpecified) {
                            String refName = element.getReferenceName();
                            int count = 0;
                            int index = 0;
                            Structure structure = element.getParent();
                            if (structure instanceof ContentModelGroup) {
                                ContentModelGroup cmg = (ContentModelGroup) structure;
                                Enumeration<Structure> enumeration = cmg.enumerate();
                                while (enumeration.hasMoreElements()) {
                                    Structure tmpStruct = enumeration.nextElement();
                                    if (tmpStruct.getStructureType() == Structure.ELEMENT) {
                                        ElementDecl tmpDecl = (ElementDecl) tmpStruct;
                                        if (tmpDecl.isReference()
                                                && tmpDecl.getReferenceName().equals(refName)) {
                                            ++count;
                                            if (tmpDecl == element) {
View Full Code Here

                return ((ComplexType) annotated).getMinOccurs();
            case Structure.MODELGROUP:
            case Structure.GROUP:
                Group group = (Group) annotated;
                //-- if the group is top-level, then we always return 0
                Structure parent = group.getParent();
                if (parent != null && parent.getStructureType() == Structure.SCHEMA) {
                    return 0;
                }
                int minOccurs = group.getMinOccurs();
                //-- if minOccurs == 1, then check to see if all elements inside group are
                //-- optional, if so, we return 0, not 1.
View Full Code Here

        name = getGroupName(group, packageName);
        if (name != null) {
            return name;
        }

        Structure parent = group.getParent();
        if (parent == null) {
            return null;
        }

        boolean addOrder = true;
        switch(parent.getStructureType()) {
            case Structure.GROUP:
                name = createClassName((Group) parent, packageName);
                break;
            case Structure.MODELGROUP:
                name = ((ModelGroup) parent).getName();
View Full Code Here

        if (name != null) {
            return _javaNaming.toJavaClassName(name);
        }

        //-- otherwise get name of containing element
        Structure parent = complexType.getParent();
        if (parent != null && parent.getStructureType() == Structure.ELEMENT) {
            name = ((ElementDecl) parent).getName();
        }

        if (name != null) {
            name = _javaNaming.toJavaClassName(name);
View Full Code Here

        boolean enumeration = false;

        //-- class name information
        String typeName = simpleType.getName();
        if (typeName == null) {
            Structure struct = simpleType.getParent();
            FactoryState fstate = null;
            switch (struct.getStructureType()) {
                case Structure.ATTRIBUTE:
                    typeName = ((AttributeDecl) struct).getName();
                    fstate = sgState.getCurrentFactoryState();
                    break;
                case Structure.ELEMENT:
                    typeName = ((ElementDecl) struct).getName();
                    break;
                default:
                    // Nothing to do
                    break;
            }
            //-- In case of naming collision we append current class name
            if (fstate != null) {
                typeName = getJavaNaming().toJavaClassName(typeName);
                Structure attrDeclParent = ((AttributeDecl) struct).getParent();
                if (attrDeclParent != null
                        && attrDeclParent.getStructureType() == Structure.ATTRIBUTE_GROUP) {
                    typeName = getJavaNaming().toJavaClassName(
                            ((AttributeGroupDecl) attrDeclParent).getName() + typeName);
                } else {
                    typeName = fstate.getJClass().getLocalName() + typeName;
                }
View Full Code Here

        if (location == null) {
            throw new IllegalArgumentException("location cannot be null");
        }

        Structure parent = null;
        switch (structure.getStructureType()) {
        case Structure.ELEMENT:
            parent = ((ElementDecl) structure).getParent();
            if (parent.getStructureType() != Structure.SCHEMA) {
                getSchemaLocation(parent, location, dealWithAnonTypes);
            }
            location.append(ExtendedBinding.PATH_SEPARATOR);
            location.append(((ElementDecl) structure).getName());
            if (parent instanceof Schema) {
                Schema schema = (Schema) parent;
                if (schema.getTargetNamespace() != null) {
                    String targetNamespace = schema.getTargetNamespace();
                    location.append("{" + targetNamespace + "}");
                }
            }
            break;

        case Structure.COMPLEX_TYPE:
            ComplexType complexType = (ComplexType) structure;
            parent = (complexType).getParent();
            if (parent.getStructureType() != Structure.SCHEMA) {
                getSchemaLocation(parent, location, dealWithAnonTypes);
            }
            if (complexType.getName() != null) {
                location.append(ExtendedBinding.PATH_SEPARATOR);
                location.append(ExtendedBinding.COMPLEXTYPE_ID);
                location.append(((ComplexType) structure).getName());
            }
//            else if (dealWithAnonTypes){
//                location.append(ExtendedBinding.PATH_SEPARATOR);
//                location.append(ExtendedBinding.COMPLEXTYPE_ID);
//                location.append("anonymous");
//            }
            break;

        case Structure.SIMPLE_TYPE:
            SimpleType simpleType = (SimpleType) structure;
            parent = simpleType.getParent();
            if (parent != null && parent.getStructureType() != Structure.SCHEMA) {
                getSchemaLocation(parent, location, dealWithAnonTypes);
            }

            if (parent != null && simpleType.getName() != null) {
                location.append(ExtendedBinding.PATH_SEPARATOR);
                location.append(ExtendedBinding.ENUMTYPE_ID);
                location.append(((SimpleType) structure).getName());
            }
//            else if (dealWithAnonTypes){
//                location.append(ExtendedBinding.PATH_SEPARATOR);
//                location.append(ExtendedBinding.ENUMTYPE_ID);
//                location.append("anonymous");
//            }
            break;

        case Structure.MODELGROUP:
            ModelGroup group = (ModelGroup) structure;
            parent = group.getParent();
            if (parent.getStructureType() != Structure.SCHEMA) {
                getSchemaLocation(parent, location, dealWithAnonTypes);
            }
            if (group.getName() != null) {
                location.append(ExtendedBinding.PATH_SEPARATOR);
                location.append(ExtendedBinding.GROUP_ID);
                location.append(group.getName());
            }
            break;

        case Structure.ATTRIBUTE:
            parent = ((AttributeDecl) structure).getParent();
            if (parent.getStructureType() != Structure.SCHEMA) {
                getSchemaLocation(parent, location, dealWithAnonTypes);
            }
            location.append(ExtendedBinding.PATH_SEPARATOR);
            location.append(ExtendedBinding.ATTRIBUTE_PREFIX);
            location.append(((AttributeDecl) structure).getName());
View Full Code Here

        //the first group is the number of particle is one

        Enumeration<Structure> enumeration = cmGroup.enumerate();

        while (enumeration.hasMoreElements()) {
            Structure struct = enumeration.nextElement();
            switch(struct.getStructureType()) {
                case Structure.ELEMENT:
                    ElementDecl eDecl = (ElementDecl) struct;
                    if (eDecl.isReference()) {
                        continue;
                    }
View Full Code Here

TOP

Related Classes of org.exolab.castor.xml.schema.Structure

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.