Package org.exolab.castor.xml.schema

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


    public XSType convertType(SimpleType simpleType, boolean useWrapper, String packageName) {
        if (simpleType == null) return null;

        XSType xsType = null;
        //-- determine base type
        SimpleType base = simpleType;

        while ((base != null) && (!base.isBuiltInType())) {
            base = (SimpleType)base.getBaseType();
        }

        if (simpleType.getStructureType() == Structure.UNION) {
            SimpleType common = findCommonType((Union)simpleType);
            if (common == null) {
                return new XSClass(SGTypes.Object);
            }
            return convertType(common, useWrapper,packageName);
        }
View Full Code Here


     *
     * @param union the Union to return the common type for
     * @return the common SimpleType for the Union.
     */
    private static SimpleType findCommonType(Union union) {
        SimpleType common = null;
        Enumeration enumeration = union.getMemberTypes();
        while (enumeration.hasMoreElements()) {
            SimpleType type = (SimpleType)enumeration.nextElement();
            type = type.getBuiltInBaseType();
            if (common == null) common = type;
            else {
                common = compare(common, type);
                //-- no common types
                if (common == null) break;
View Full Code Here

                    //work with the simple type of the content type.
                    SimpleContent contentType = (SimpleContent)temp.getContentType();
                    _complexType.setBaseType(temp);
                    _complexType.setBase(temp.getName());
              _simpleTypeDef = new SimpleTypeDefinition(_schema, temp.getName(),_id);
              SimpleType simpleType = contentType.getSimpleType();
              if (simpleType != null) {
                        _simpleTypeDef.setBaseType(simpleType);
                    }
                    else {
                        _simpleTypeDef.setBaseTypeName(contentType.getTypeName());
View Full Code Here

                (AttributeGroupReference) unmarshaller.getObject();
            _complexType.addAttributeGroupReference(attrGroupRef);
        }
        //-- simpleType
    else if (SchemaNames.SIMPLE_TYPE.equals(name)) {
            SimpleType type = (SimpleType) unmarshaller.getObject();
            _complexType.setContentType(new SimpleContent(type));
        }
        //--facet
    else {
           _simpleTypeDef.addFacet((Facet)unmarshaller.getObject());
View Full Code Here

     * only related to a complexType...)
     */
    public void finish() {

        if (_simpleTypeDef != null) {
            SimpleType baseType = _simpleTypeDef.createSimpleType();
            _complexType.setContentType(new SimpleContent(baseType));
        }
    //the restriction was properly handle
    //we can set the flag
    _complexType.setRestriction(true);
View Full Code Here

        if (SchemaNames.ANNOTATION.equals(name)) {
            Annotation ann = (Annotation) unmarshaller.getObject();
            _attribute.addAnnotation(ann);
        }
        else if (SchemaNames.SIMPLE_TYPE.equals(name)) {
            SimpleType simpleType =
                ((SimpleTypeUnmarshaller)unmarshaller).getSimpleType();
            _attribute.setSimpleType(simpleType);
        }

        unmarshaller = null;
View Full Code Here

        if (SchemaNames.ANNOTATION.equals(name)) {
            _union.setLocalAnnotation((Annotation)_unmarshaller.getObject());
        }
        else if (SchemaNames.SIMPLE_TYPE.equals(name)) {
           
            SimpleType simpleType =
                (SimpleType)_unmarshaller.getObject();
               
            //-- make sure type is not another Union
            if (simpleType instanceof Union) {
                String err = "A 'union' may only contain SimpleTypes of "+
View Full Code Here

            return;
           
        StringTokenizer st = new StringTokenizer(memberTypes);
        while (st.hasMoreTokens()) {
            String typeName = st.nextToken();
            SimpleType simpleType = _schema.getSimpleType(typeName);
            if (simpleType != null) {
                _union.addMemberType(simpleType);
            }
            else {
                _union.addMemberType(typeName);
View Full Code Here

     *
     * @return the simpleType for the items of this ListType.
    **/
    public SimpleType getItemType() {
        if (_hasReference) {
            SimpleType simpleType = resolveReference(_itemType);
            if (simpleType == null) {
                String err = "Unable to resolve type: " + _itemType.getName();
                throw new IllegalStateException(err);
            }
            _hasReference = false;
View Full Code Here

        if (SchemaNames.ANNOTATION.equals(name)) {
            Annotation ann = ((AnnotationUnmarshaller)unmarshaller).getAnnotation();
            _typeDefinition.setAnnotation(ann);
        }
        else if (SchemaNames.SIMPLE_TYPE.equals(name)) {
            SimpleType type = (SimpleType) unmarshaller.getObject();
            _typeDefinition.setBaseType(type);
        }
        else {
            _typeDefinition.addFacet((Facet)unmarshaller.getObject());
        }
View Full Code Here

TOP

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

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.