FileDocCategorySizeDatePackage
XSDUniqueOrKeyTraverser.javaAPI DocJava SE 5 API5271Fri Aug 26 14:55:52 BST 2005com.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.
author
Neil Graham, IBM
version
$Id: XSDUniqueOrKeyTraverser.java,v 1.6 2003/05/08 20:11:57 elena 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);