com.sun.msv.verifier.identity.FieldsMatcher Maven / Gradle / Ivy
/*
* @(#)$Id: FieldsMatcher.java,v 1.7 2003/06/09 20:37:42 kk122374 Exp $
*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
*
* This software is the proprietary information of Sun Microsystems, Inc.
* Use is subject to license terms.
*
*/
package com.sun.msv.verifier.identity;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.LocatorImpl;
import com.sun.msv.grammar.xmlschema.KeyConstraint;
import com.sun.msv.grammar.xmlschema.KeyRefConstraint;
/**
* Coordinator of FieldMatcher.
*
* This object is created when SelectorMatcher finds a match.
* This object then creates FieldMatcher for each field, and
* let them find their field matchs.
* When leaving the element that matched the selector, it collects
* field values and registers a key value to IDConstraintChecker.
*
*
* Depending on the type of the constraint, it works differently.
*
* @author Kohsuke KAWAGUCHI
*/
public class FieldsMatcher extends MatcherBundle {
/**
* location of the start tag.
* It is usually preferable as a source of error.
*/
protected final Locator startTag;
/**
* the parent SelectorMatcher.
*/
protected final SelectorMatcher selector;
protected FieldsMatcher( SelectorMatcher selector, String namespaceURI, String localName ) throws SAXException {
super(selector.owner);
this.selector = selector;
if(owner.getLocator()==null)
this.startTag = null;
else
this.startTag = new LocatorImpl(owner.getLocator());
children = new Matcher[selector.idConst.fields.length];
for( int i=0; i