Package org.apache.xmlbeans

Examples of org.apache.xmlbeans.SchemaGlobalElement


    {
        StscState state = StscState.get();

        for (int i = 0 ; i < elts.length ; i++)
        {
            SchemaGlobalElement elt = elts[i];
            SchemaGlobalElement head = elt.substitutionGroup();

            if (head != null)
            {
                SchemaType headType = head.getType();
                SchemaType tailType = elt.getType();
                XmlObject parseTree = ((SchemaGlobalElementImpl)elt)._parseObject;

                if (! headType.isAssignableFrom(tailType))
                {
                    state.error("Element " + QNameHelper.pretty(elt.getName()) +
                        " must have a type that is derived from the type of its substitution group.",
                        XmlErrorContext.INCONSISTENT_TYPE, parseTree);
                   
                }
                else if (head.finalExtension() && head.finalRestriction())
                {
                    state.error("Element " + QNameHelper.pretty(elt.getName()) +
                        " cannot be substituted for element with final='#all'",
                        XmlErrorContext.CANNOT_DERIVE_FINAL, parseTree);
                }
                else if (! headType.equals(tailType))
                {
                    if (head.finalExtension() &&
                             tailType.getDerivationType() == SchemaType.DT_EXTENSION)
                    {
                        state.error("Element " + QNameHelper.pretty(elt.getName()) +
                            " cannot be substituted for element with final='extension'",
                            XmlErrorContext.CANNOT_DERIVE_FINAL, parseTree);
                    }
                    else if (head.finalRestriction() &&
                             tailType.getDerivationType() == SchemaType.DT_RESTRICTION)
                    {
                        state.error("Element " + QNameHelper.pretty(elt.getName()) +
                            " cannot be substituted for element with final='restriction'",
                            XmlErrorContext.CANNOT_DERIVE_FINAL, parseTree);
View Full Code Here


        else
        {
            if (!_typedWildcardElements.contains(eltName))
                return BuiltinSchemaTypeSystem.ST_NO_TYPE;

            SchemaGlobalElement elt = wildcardTypeLoader.findElement(eltName);
            if (elt == null)
                return BuiltinSchemaTypeSystem.ST_ANY_TYPE;
            type = elt.getType();
        }

        if (xsiType != null)
        {
            SchemaType itype = wildcardTypeLoader.findType(xsiType);
View Full Code Here

            {
                type = BuiltinSchemaTypeSystem.ST_NO_TYPE;
            }
            else
            {
                SchemaGlobalElement elt = wildcardTypeLoader.findElement(eltName);
                if (elt != null)
                    type = elt.getType();
                else
                    type = BuiltinSchemaTypeSystem.ST_ANY_TYPE;
            }

            if (xsiType != null)
View Full Code Here

                            "Element substitution not allowed when group head has block='substitution'", name);
                        _eatContent = 1;
                        return;
                    }

                    SchemaGlobalElement newField = _globalTypes.findElement(name);

                    assert newField != null;

                    if (newField != null)
                        elementField = newField;
View Full Code Here

        ret = type.getFullJavaName();
        return ret.replace('$', '.');
    }

    public String getWrappedElementType(QName wrapperElement, QName item) {       
        SchemaGlobalElement elem = typeSystem.findElement(wrapperElement);

        if (elem == null)  {
            elem = typeLoader.findElement(wrapperElement);
        }

        SchemaType st = elem.getType();
        SchemaProperty prop = st.getElementProperty(item);
        SchemaType partType = prop.getType();
        String s = XMLBeansSchemaTypeUtils.getNaturalJavaClassName(partType);
        if (prop.extendsJavaArray()) {
            s += "[]";
View Full Code Here

        ret = type.getFullJavaName();
        return ret.replace('$', '.');
    }

    public String getWrappedElementType(QName wrapperElement, QName item) {       
        SchemaGlobalElement elem = typeSystem.findElement(wrapperElement);

        if (elem == null)  {
            elem = typeLoader.findElement(wrapperElement);
        }

        SchemaType st = elem.getType();
        SchemaProperty prop = st.getElementProperty(item);
        SchemaType partType = prop.getType();
        String s = XMLBeansSchemaTypeUtils.getNaturalJavaClassName(partType);
        if (prop.extendsJavaArray()) {
            s += "[]";
View Full Code Here

            QName typeQName = globalType.getName();
            addSchemaType(typeQName, globalType, false, qnameMap);
        }
        SchemaGlobalElement[] globalElements = schemaTypeSystem.globalElements();
        for (int i = 0; i < globalElements.length; i++) {
            SchemaGlobalElement globalElement = globalElements[i];
            addElement(globalElement, null, qnameMap);
        }
        return qnameMap;
    }
View Full Code Here

                        _eatContent = 1;
                        return;
                    }

                    SchemaGlobalElement newField = _globalTypes.findElement(name);

                    assert newField != null;

                    if (newField != null)
                    {
View Full Code Here

    {
        StscState state = StscState.get();

        for (int i = 0 ; i < elts.length ; i++)
        {
            SchemaGlobalElement elt = elts[i];
            SchemaGlobalElement head = elt.substitutionGroup();

            if (head != null)
            {
                SchemaType headType = head.getType();
                SchemaType tailType = elt.getType();
                XmlObject parseTree = ((SchemaGlobalElementImpl)elt)._parseObject;

                if (! headType.isAssignableFrom(tailType))
                {
                    state.error(XmlErrorCodes.ELEM_PROPERTIES$SUBSTITUTION_VALID,
                        new Object[] {QNameHelper.pretty(elt.getName()),
                                      QNameHelper.pretty(head.getName())},
                        parseTree);
                }
                else if (head.finalExtension() && head.finalRestriction())
                {
                    state.error(XmlErrorCodes.ELEM_PROPERTIES$SUBSTITUTION_FINAL,
                        new Object[] {QNameHelper.pretty(elt.getName()),
                                      QNameHelper.pretty(head.getName()),
                                      "#all"}, parseTree);
                }
                else if (! headType.equals(tailType))
                {
                    if (head.finalExtension() &&
                             tailType.getDerivationType() == SchemaType.DT_EXTENSION)
                    {
                        state.error(XmlErrorCodes.ELEM_PROPERTIES$SUBSTITUTION_FINAL,
                            new Object[] {QNameHelper.pretty(elt.getName()),
                                          QNameHelper.pretty(head.getName()),
                                          "extension"}, parseTree);
                    }
                    else if (head.finalRestriction() &&
                             tailType.getDerivationType() == SchemaType.DT_RESTRICTION)
                    {
                        state.error(XmlErrorCodes.ELEM_PROPERTIES$SUBSTITUTION_FINAL,
                            new Object[] {QNameHelper.pretty(elt.getName()),
                                          QNameHelper.pretty(head.getName()),
                                          "restriction"}, parseTree);
                    }
                }
            }
View Full Code Here

                return BuiltinSchemaTypeSystem.ST_NO_TYPE;

            if (_typedWildcardElements.contains(eltName) ||
                _validSubstitutions.contains(eltName))
            {
                SchemaGlobalElement elt = wildcardTypeLoader.findElement(eltName);
                if (elt == null)
                    return BuiltinSchemaTypeSystem.ST_NO_TYPE;
                // According to http://www.w3.org/TR/xmlschema-1/#key-lva,
                // the line above should return ST_ANY_TYPE.
                type = elt.getType();
            }
            else
            {
                // Substitution groups
                // Actually, better not enable this yet
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.SchemaGlobalElement

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.