Examples of XSAttributeGroupDecl


Examples of org.apache.xerces.impl.xs.XSAttributeGroupDecl

    }

    private void addGlobalAttributeGroupDecls(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
        XSNamedMap components = srcGrammar.getComponents(XSConstants.ATTRIBUTE_GROUP);
        int len = components.getLength();
        XSAttributeGroupDecl srcDecl, dstDecl;

        // add global components
        for (int i=0; i<len; i++) {
            srcDecl = (XSAttributeGroupDecl) components.item(i);
            dstDecl = dstGrammar.getGlobalAttributeGroupDecl(srcDecl.getName());
            if (dstDecl == null) {
                dstGrammar.addGlobalAttributeGroupDecl(srcDecl);
            }
            else if (dstDecl != srcDecl && !fTolerateDuplicates) {
                reportSharingError(srcDecl.getNamespace(), srcDecl.getName());
            }
        }

        // add any extended (duplicate) global components
        ObjectList componentsExt = srcGrammar.getComponentsExt(XSConstants.ATTRIBUTE_GROUP);
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSAttributeGroupDecl

    Element traverseAttrsAndAttrGrps(Element firstAttr, XSAttributeGroupDecl attrGrp,
                                     XSDocumentInfo schemaDoc, SchemaGrammar grammar,
                                     XSComplexTypeDecl enclosingCT) {

        Element child=null;
        XSAttributeGroupDecl tempAttrGrp = null;
        XSAttributeUseImpl tempAttrUse = null;
        String childName;

        for (child=firstAttr; child!=null; child=DOMUtil.getNextSiblingElement(child)) {
            childName = DOMUtil.getLocalName(child);
            if (childName.equals(SchemaSymbols.ELT_ATTRIBUTE)) {
                tempAttrUse = fSchemaHandler.fAttributeTraverser.traverseLocal(child,
                                                                               schemaDoc,
                                                                               grammar,
                                                                               enclosingCT);
                if (tempAttrUse == null) break;
                if (attrGrp.getAttributeUse(tempAttrUse.fAttrDecl.fTargetNamespace,
                                            tempAttrUse.fAttrDecl.fName)==null) {
                    String idName = attrGrp.addAttributeUse(tempAttrUse);
                    if (idName != null) {
                        String code = (enclosingCT == null) ? "ag-props-correct.3" : "ct-props-correct.5";
                        String name = (enclosingCT == null) ? attrGrp.fName : enclosingCT.fName;
                        reportSchemaError(code, new Object[]{name, tempAttrUse.fAttrDecl.fName, idName}, child);
                    }
                }
                else {
                    // REVISIT: what if one of the attribute uses is "prohibited"
                    String code = (enclosingCT == null) ? "ag-props-correct.2" : "ct-props-correct.4";
                    String name = (enclosingCT == null) ? attrGrp.fName : enclosingCT.fName;
                    reportSchemaError(code, new Object[]{name, tempAttrUse.fAttrDecl.fName}, child);
                }
            }
            else if (childName.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP)) {
                //REVISIT: do we need to save some state at this point??
                tempAttrGrp = fSchemaHandler.fAttributeGroupTraverser.traverseLocal(
                       child, schemaDoc, grammar);
                if(tempAttrGrp == null ) break;
                XSObjectList attrUseS = tempAttrGrp.getAttributeUses();
                XSAttributeUseImpl existingAttrUse = null, oneAttrUse;
                int attrCount = attrUseS.getLength();
                for (int i=0; i<attrCount; i++) {
                    oneAttrUse = (XSAttributeUseImpl)attrUseS.getItem(i);
                    existingAttrUse = attrGrp.getAttributeUse(oneAttrUse.fAttrDecl.fTargetNamespace,
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSAttributeGroupDecl

        Object[] attrValues = fAttrChecker.checkAttributes(elmNode, false, schemaDoc);

        // get attribute
        QName   refAttr  = (QName)   attrValues[XSAttributeChecker.ATTIDX_REF];

        XSAttributeGroupDecl attrGrp = null;

        // ref should be here.
        if (refAttr == null) {
            reportSchemaError("s4s-att-must-appear", new Object[]{"attributeGroup (local)", "ref"}, elmNode);
            fAttrChecker.returnAttrArray(attrValues, schemaDoc);
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSAttributeGroupDecl

    XSAttributeGroupDecl traverseGlobal(Element elmNode,
                                        XSDocumentInfo schemaDoc,
                                        SchemaGrammar grammar) {

        XSAttributeGroupDecl attrGrp = new XSAttributeGroupDecl();

        // General Attribute Checking for elmNode declared globally
        Object[] attrValues = fAttrChecker.checkAttributes(elmNode, true, schemaDoc);

        String  nameAttr   = (String) attrValues[XSAttributeChecker.ATTIDX_NAME];

        // global declaration must have a name
        if (nameAttr == null) {
            reportSchemaError("s4s-att-must-appear", new Object[]{"attributeGroup (global)", "name"}, elmNode);
            nameAttr = "no name";
        }

        attrGrp.fName = nameAttr;
        attrGrp.fTargetNamespace = schemaDoc.fTargetNamespace;

        // check the content
        Element child = DOMUtil.getFirstChildElement(elmNode);

        if (child!=null) {
            String childName = DOMUtil.getLocalName(child);
            if (childName.equals(SchemaSymbols.ELT_ANNOTATION)) {
              traverseAnnotationDecl(child, attrValues, false, schemaDoc);
              child = DOMUtil.getNextSiblingElement(child);
          }
        }

        // Traverse the attribute and attribute group elements and fill in the
        // attributeGroup structure

        Element nextNode = traverseAttrsAndAttrGrps(child, attrGrp, schemaDoc, grammar, null);
        if (nextNode!=null) {
            // An invalid element was found...
            Object[] args = new Object [] {nameAttr, DOMUtil.getLocalName(nextNode)};
            reportSchemaError("src-attribute_group", args, nextNode);
        }
        // Remove prohibited attributes from the set
        attrGrp.removeProhibitedAttrs();
       
        // check for restricted redefine:
        XSAttributeGroupDecl redefinedAttrGrp = (XSAttributeGroupDecl)fSchemaHandler.getGrpOrAttrGrpRedefinedByRestriction(
                XSDHandler.ATTRIBUTEGROUP_TYPE,
                new QName(fSchemaHandler.EMPTY_STRING, nameAttr, nameAttr, schemaDoc.fTargetNamespace),
                schemaDoc, elmNode);
        if(redefinedAttrGrp != null) {
            String err = attrGrp.validRestrictionOf(redefinedAttrGrp);
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSAttributeGroupDecl

                    QName aname = new QName(); // REVISIT: cache this

                    // Get the list of attributes from the element decl.
                    // REVISIT - is this correct?   This is what was done in xerces-1,
                    // but is it right?
                    XSAttributeGroupDecl attrGrp = null;
                    if (elementDecl != null) {
                        XSTypeDecl type = elementDecl.fType;
                        if (type != null) {
                          if (type.getTypeCategory() == XSTypeDecl.COMPLEX_TYPE) {
                            XSComplexTypeDecl ctype = (XSComplexTypeDecl)type;
                            attrGrp = ctype.fAttrGrp;
                          }
                        }
                    }

                    for (int aindex = 0; aindex < attrCount; aindex++) {
                        attributes.getName(aindex, aname);
                        if (nodeTest.type != XPath.NodeTest.QNAME ||
                            nodeTest.name.equals(aname)) {
                            fCurrentStep[i]++;
                            if (fCurrentStep[i] == steps.length) {
                                fMatched[i] = true;
                                int j=0;
                                for(; j<i && !fMatched[j]; j++);
                                if(j==i) {
                                    String avalue = attributes.getValue(aindex);
                                    fMatchedString = avalue;
                                    // now, we have to go on the hunt for
                                    // datatype validator; not an easy or pleasant task...

                                    XSSimpleType aValidator = null;
                                    if (attrGrp != null) {
                                      XSAttributeUseImpl tempAttUse = attrGrp.getAttributeUse(aname.uri, aname.localpart);
                                      if (tempAttUse != null) {
                                        XSAttributeDecl tempAttDecl = tempAttUse.fAttrDecl;
                                        aValidator = tempAttDecl.fType;
                                      }
                                    }
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSAttributeGroupDecl

                                                      Object[] attrValues,
                                                      XSDocumentInfo schemaDoc,
                                                      SchemaGrammar grammar) {

        fComplexTypeDecl = new XSComplexTypeDecl();
        fAttrGrp = new XSAttributeGroupDecl();
        Boolean abstractAtt  = (Boolean) attrValues[XSAttributeChecker.ATTIDX_ABSTRACT];
        XInt    blockAtt     = (XInt)    attrValues[XSAttributeChecker.ATTIDX_BLOCK];
        Boolean mixedAtt     = (Boolean) attrValues[XSAttributeChecker.ATTIDX_MIXED];
        XInt    finalAtt     = (XInt)    attrValues[XSAttributeChecker.ATTIDX_FINAL];
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSAttributeGroupDecl

    Element traverseAttrsAndAttrGrps(Element firstAttr, XSAttributeGroupDecl attrGrp,
                                     XSDocumentInfo schemaDoc, SchemaGrammar grammar,
                                     XSComplexTypeDecl enclosingCT) {

        Element child=null;
        XSAttributeGroupDecl tempAttrGrp = null;
        XSAttributeUseImpl tempAttrUse = null;
        String childName;

        for (child=firstAttr; child!=null; child=DOMUtil.getNextSiblingElement(child)) {
            childName = DOMUtil.getLocalName(child);
            if (childName.equals(SchemaSymbols.ELT_ATTRIBUTE)) {
                tempAttrUse = fSchemaHandler.fAttributeTraverser.traverseLocal(child,
                                                                               schemaDoc,
                                                                               grammar,
                                                                               enclosingCT);
                if (tempAttrUse == null) break;
                if (attrGrp.getAttributeUse(tempAttrUse.fAttrDecl.getNamespace(),
                                            tempAttrUse.fAttrDecl.getName())==null) {
                    String idName = attrGrp.addAttributeUse(tempAttrUse);
                    if (idName != null) {
                        String code = (enclosingCT == null) ? "ag-props-correct.3" : "ct-props-correct.5";
                        String name = (enclosingCT == null) ? attrGrp.fName : enclosingCT.getName();
                        reportSchemaError(code, new Object[]{name, tempAttrUse.fAttrDecl.getName(), idName}, child);
                    }
                }
                else {
                    // REVISIT: what if one of the attribute uses is "prohibited"
                    String code = (enclosingCT == null) ? "ag-props-correct.2" : "ct-props-correct.4";
                    String name = (enclosingCT == null) ? attrGrp.fName : enclosingCT.getName();
                    reportSchemaError(code, new Object[]{name, tempAttrUse.fAttrDecl.getName()}, child);
                }
            }
            else if (childName.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP)) {
                //REVISIT: do we need to save some state at this point??
                tempAttrGrp = fSchemaHandler.fAttributeGroupTraverser.traverseLocal(
                       child, schemaDoc, grammar);
                if(tempAttrGrp == null ) break;
                XSObjectList attrUseS = tempAttrGrp.getAttributeUses();
                XSAttributeUseImpl existingAttrUse = null, oneAttrUse;
                int attrCount = attrUseS.getLength();
                for (int i=0; i<attrCount; i++) {
                    oneAttrUse = (XSAttributeUseImpl)attrUseS.getItem(i);
                    existingAttrUse = attrGrp.getAttributeUse(oneAttrUse.fAttrDecl.getNamespace(),
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSAttributeGroupDecl

        Object[] attrValues = fAttrChecker.checkAttributes(elmNode, false, schemaDoc);

        // get attribute
        QName   refAttr  = (QName)   attrValues[XSAttributeChecker.ATTIDX_REF];

        XSAttributeGroupDecl attrGrp = null;

        // ref should be here.
        if (refAttr == null) {
            reportSchemaError("s4s-att-must-appear", new Object[]{"attributeGroup (local)", "ref"}, elmNode);
            fAttrChecker.returnAttrArray(attrValues, schemaDoc);
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSAttributeGroupDecl

    XSAttributeGroupDecl traverseGlobal(Element elmNode,
                                        XSDocumentInfo schemaDoc,
                                        SchemaGrammar grammar) {

        XSAttributeGroupDecl attrGrp = new XSAttributeGroupDecl();

        // General Attribute Checking for elmNode declared globally
        Object[] attrValues = fAttrChecker.checkAttributes(elmNode, true, schemaDoc);

        String  nameAttr   = (String) attrValues[XSAttributeChecker.ATTIDX_NAME];

        // global declaration must have a name
        if (nameAttr == null) {
            reportSchemaError("s4s-att-must-appear", new Object[]{"attributeGroup (global)", "name"}, elmNode);
            nameAttr = "no name";
        }

        attrGrp.fName = nameAttr;
        attrGrp.fTargetNamespace = schemaDoc.fTargetNamespace;

        // check the content
        Element child = DOMUtil.getFirstChildElement(elmNode);

        if (child!=null) {
            String childName = DOMUtil.getLocalName(child);
            if (childName.equals(SchemaSymbols.ELT_ANNOTATION)) {
              traverseAnnotationDecl(child, attrValues, false, schemaDoc);
              child = DOMUtil.getNextSiblingElement(child);
          }
        }

        // Traverse the attribute and attribute group elements and fill in the
        // attributeGroup structure

        Element nextNode = traverseAttrsAndAttrGrps(child, attrGrp, schemaDoc, grammar, null);
        if (nextNode!=null) {
            // An invalid element was found...
            Object[] args = new Object [] {nameAttr, DOMUtil.getLocalName(nextNode)};
            reportSchemaError("src-attribute_group", args, nextNode);
        }
        // Remove prohibited attributes from the set
        attrGrp.removeProhibitedAttrs();
       
        // check for restricted redefine:
        XSAttributeGroupDecl redefinedAttrGrp = (XSAttributeGroupDecl)fSchemaHandler.getGrpOrAttrGrpRedefinedByRestriction(
                XSDHandler.ATTRIBUTEGROUP_TYPE,
                new QName(XMLSymbols.EMPTY_STRING, nameAttr, nameAttr, schemaDoc.fTargetNamespace),
                schemaDoc, elmNode);
        if(redefinedAttrGrp != null) {
            String err = attrGrp.validRestrictionOf(redefinedAttrGrp);
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSAttributeGroupDecl

                    QName aname = new QName(); // REVISIT: cache this

                    // Get the list of attributes from the element decl.
                    // REVISIT - is this correct?   This is what was done in xerces-1,
                    // but is it right?
                    XSAttributeGroupDecl attrGrp = null;
                    if (elementDecl != null) {
                        XSTypeDecl type = elementDecl.fType;
                        if (type != null) {
                          if (type.getTypeCategory() == XSTypeDecl.COMPLEX_TYPE) {
                            XSComplexTypeDecl ctype = (XSComplexTypeDecl)type;
                            attrGrp = ctype.getAttrGrp();
                          }
                        }
                    }

                    for (int aIndex = 0; aIndex < attrCount; aIndex++) {
                        attributes.getName(aIndex, aname);
                        if (nodeTest.type != XPath.NodeTest.QNAME ||
                            nodeTest.name.equals(aname)) {
                            fCurrentStep[i]++;
                            if (fCurrentStep[i] == steps.length) {
                                fMatched[i] = MATCHED_ATTRIBUTE;
                                int j=0;
                                for(; j<i && ((fMatched[j] & MATCHED) != MATCHED); j++);
                                if(j==i) {
                                    String avalue = attributes.getValue(aIndex);
                                    fMatchedString = avalue;

                                    // find Datatype validator...
                                    XSSimpleType aValidator = null;
                                    if (attrGrp != null) {
                                      XSAttributeUseImpl tempAttUse = attrGrp.getAttributeUse(aname.uri, aname.localpart);
                                      if (tempAttUse != null) {
                                        XSAttributeDecl tempAttDecl = tempAttUse.fAttrDecl;
                                        aValidator = (XSSimpleType)tempAttDecl.getTypeDefinition();
                                      }
                                    }
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.