FileDocCategorySizeDatePackage
XSDUniqueOrKeyTraverser.javaAPI DocJava SE 6 API3239Tue Jun 10 00:22:48 BST 2008com.sun.org.apache.xerces.internal.impl.xs.traversers

XSDUniqueOrKeyTraverser

public class XSDUniqueOrKeyTraverser extends XSDAbstractIDConstraintTraverser
This class contains code that is used to traverse both s and s.
xerces.internal
author
Neil Graham, IBM
version
$Id: XSDUniqueOrKeyTraverser.java,v 1.2.6.1 2005/09/09 07:25:38 sunithareddy Exp $

Fields Summary
Constructors Summary
public XSDUniqueOrKeyTraverser(XSDHandler handler, XSAttributeChecker gAttrCheck)

        super(handler, gAttrCheck);
    
Methods Summary
voidtraverse(org.w3c.dom.Element uElem, com.sun.org.apache.xerces.internal.impl.xs.XSElementDecl element, com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDocumentInfo schemaDoc, com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar grammar)


        // General Attribute Checking
        Object[] attrValues = fAttrChecker.checkAttributes(uElem, false, schemaDoc);

        // create identity constraint
        String uName = (String)attrValues[XSAttributeChecker.ATTIDX_NAME];

        if(uName == null){
            reportSchemaError("s4s-att-must-appear", new Object [] {DOMUtil.getLocalName(uElem) , SchemaSymbols.ATT_NAME }, uElem);
            //return this array back to pool
            fAttrChecker.returnAttrArray(attrValues, schemaDoc);
            return;
        }

        UniqueOrKey uniqueOrKey = null;
        if(DOMUtil.getLocalName(uElem).equals(SchemaSymbols.ELT_UNIQUE)) {
            uniqueOrKey = new UniqueOrKey(schemaDoc.fTargetNamespace, uName, element.fName, IdentityConstraint.IC_UNIQUE);
        } else {
            uniqueOrKey = new UniqueOrKey(schemaDoc.fTargetNamespace, uName, element.fName, IdentityConstraint.IC_KEY);
        }
        // it's XSDElementTraverser's job to ensure that there's no
        // duplication (or if there is that restriction is involved
        // and there's identity).

        // get selector and fields
        traverseIdentityConstraint(uniqueOrKey, uElem, schemaDoc, attrValues);

        // and stuff this in the grammar
        grammar.addIDConstraintDecl(element, uniqueOrKey);

        // and fix up attributeChecker
        fAttrChecker.returnAttrArray(attrValues, schemaDoc);