Examples of AttributeDecl


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

                group.setOrder(_defaultGroupOrder);
                //-- add attributes
                try {
                    cType.addGroup(group);
                    for (int i = 0; i < sInfo.attributes.size(); i++) {
                        AttributeDecl attDecl =
                            (AttributeDecl)sInfo.attributes.elementAt(i);
                        cType.addAttributeDecl(attDecl);
                    }
                }
                catch(SchemaException sx) {
                    throw new SAXException(sx);
                }
            }
        }
        else {
            ComplexType cType = (ComplexType)sInfo.element.getType();
           
            if ((cType == null) && (sInfo.attributes.size() > 0)) {
                cType = new ComplexType(_schema);
                sInfo.element.setType(cType);
                Group group = new Group();
                group.setOrder(_defaultGroupOrder);
                //-- add attributes
                try {
                    cType.addGroup(group);
                }
                catch(SchemaException sx) {
                    throw new SAXException(sx);
                }
            }
           
            if (cType != null) {
                for (int i = 0; i < sInfo.attributes.size(); i++) {
                    AttributeDecl attDecl =
                        (AttributeDecl)sInfo.attributes.elementAt(i);
                    cType.addAttributeDecl(attDecl);
                }
            }
        }
View Full Code Here

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

                prefix = attName.substring(0, idx);
                attName = attName.substring(idx+1);
            }
            if (prefix.equals(XMLNS)) continue;
           
            AttributeDecl attr = new AttributeDecl(_schema, attName);
           
            //-- guess simple type
            String typeName = _nsPrefix + ':' +
                DatatypeHandler.guessType(atts.getValue(i));
               
            attr.setSimpleTypeReference(typeName);
           
            sInfo.attributes.addElement(attr);
        }
       
    } //-- startElement
View Full Code Here

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

        //-- add all attributes from type2
        enumeration = cType2.getAttributeDecls();
       
        while (enumeration.hasMoreElements()) {
            //-- check for attribute with same name
            AttributeDecl attNew =  (AttributeDecl)enumeration.nextElement();
                   
            String attName = attNew.getName();
            AttributeDecl attPrev = cType1.getAttributeDecl(attName);
            if (attPrev == null) {
                attNew.setUse(AttributeDecl.USE_OPTIONAL);
                cType1.addAttributeDecl(attNew);
            }
            else {
                String type1 = attPrev.getSimpleType().getName();
                String type2 = attNew.getSimpleType().getName();
                if (!type1.equals(type2)) {
                    String typeName = _nsPrefix + ':' +
                        DatatypeHandler.whichType(type1, type2);
                    attPrev.setSimpleTypeReference(typeName);                        }
            }
        }
       
        //-- loop through all element/attribute declarations
        //-- of e1 and if they do not exist in e2, simply
View Full Code Here

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

            if (xsType == null) {
                //-- patch for bug 1471 (No XMLType specified)
                //-- treat unspecified type as anyType
                switch (component.getAnnotated().getStructureType()) {
                case Structure.ATTRIBUTE:
                    AttributeDecl attribute = (AttributeDecl) component.getAnnotated();
                    if (!attribute.hasXMLType()) {
                        xsType = new XSClass(SGTypes.OBJECT);
                    }
                    break;               
                case Structure.ELEMENT:
                    ElementDecl element = (ElementDecl) component.getAnnotated();
View Full Code Here

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

        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()) {
View Full Code Here

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

        }

        switch (_annotated.getStructureType()) {
            case Structure.ATTRIBUTE:
                //--resolve reference?
                AttributeDecl attribute = (AttributeDecl) _annotated;
                if (attribute.isReference()) {
                    attribute = attribute.getReference();
                }
                _schema = attribute.getSchema();
                attribute = null;
                break;
            case Structure.ELEMENT:
                //--resolve reference?
                ElementDecl element = (ElementDecl) _annotated;
View Full Code Here

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

            }

            if (result == null || result.length() <= 0) {
                Annotated temp = null;
                if (_annotated.getStructureType() == Structure.ATTRIBUTE) {
                     AttributeDecl att = (AttributeDecl) _annotated;
                     if (att.isReference()) {
                         temp = _annotated;
                         setView(att.getReference());
                         result = getJavaMemberName();
                         setView(temp);
                     }
                     att = null;
                } else if (_annotated.getStructureType() == Structure.ELEMENT) {
View Full Code Here

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

            return;
        }

        Enumeration<AttributeDecl> enumeration = complexType.getAttributeDecls();
        while (enumeration.hasMoreElements()) {
            AttributeDecl attribute = enumeration.nextElement();
            processSimpleType(attribute.getSimpleType(), sInfo);
        }
    } //-- processAttributes
View Full Code Here

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

        }
        //Note: the attributes are added to the complexType
        //since a simpleType does not contain attributes at all
        //-- attribute
    else if (SchemaNames.ATTRIBUTE.equals(name)) {
            AttributeDecl attrDecl =
                ((AttributeUnmarshaller)unmarshaller).getAttribute();

      /**@todo add the validation code later*/

      /*ComplexType baseType = (ComplexType)_complexType.getBaseType();
View Full Code Here

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

                throw new IllegalArgumentException(e.getMessage());
            }
        }
    //-- attribute
    else if (SchemaNames.ATTRIBUTE.equals(name)) {
            AttributeDecl attrDecl =
                ((AttributeUnmarshaller)unmarshaller).getAttribute();

             /**@todo do the validation later*/
            _complexType.addAttributeDecl(attrDecl);
        }
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.