com.sun.msv.verifier.identity
Class FieldMatcher

java.lang.Object
  extended by com.sun.msv.verifier.identity.Matcher
      extended by com.sun.msv.verifier.identity.PathMatcher
          extended by com.sun.msv.verifier.identity.FieldMatcher

public class FieldMatcher
extends PathMatcher

XPath matcher that tests one field of a key. This object is created by a FieldsMatcher when a SelectorMathcer finds a match to its selector. This object is responsible for finding a match to one field of the constraint. A field XPath may consist of "A|B|C". Each sub case A,B, and C is tested by a child FieldPathMatcher object. This class coordinates the work of those children and collects actual text that matches the given XPath.

Author:
Kohsuke KAWAGUCHI

Field Summary
protected  Matcher[] children
          child matchers.
protected  StringBuffer elementText
          this field is set to non-null if it's found that an element is matched to this XPath.
protected  Field field
           
protected  FieldsMatcher parent
          parent FieldsMatcher object.
protected  Object value
          the matched value.
 
Fields inherited from class com.sun.msv.verifier.identity.Matcher
owner
 
Method Summary
protected  void characters(char[] buf, int start, int len)
           
protected  void endElement(Datatype type)
           
protected  int getDepth()
           
protected  void onAttributeMatched(String namespaceURI, String localName, String value, Datatype type)
          this method is called when the attribute matches the XPath.
protected  void onElementMatched(String namespaceURI, String localName)
          this method is called when the element matches the XPath.
protected  void onRemoved()
          called when this bundle is deactivated.
protected  void startElement(String namespaceURI, String localName, Attributes attributes)
           
 
Methods inherited from class com.sun.msv.verifier.identity.PathMatcher
onAttribute, start, startElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

field

protected Field field

value

protected Object value
the matched value. If this field is null, then it means nothing is matched yet.


parent

protected final FieldsMatcher parent
parent FieldsMatcher object.


elementText

protected StringBuffer elementText
this field is set to non-null if it's found that an element is matched to this XPath. This field is then used to collect the contents of the matched element until it encounters the endElement method.


children

protected Matcher[] children
child matchers.

Method Detail

onElementMatched

protected void onElementMatched(String namespaceURI,
                                String localName)
                         throws SAXException
this method is called when the element matches the XPath.

Specified by:
onElementMatched in class PathMatcher
Throws:
SAXException

onAttributeMatched

protected void onAttributeMatched(String namespaceURI,
                                  String localName,
                                  String value,
                                  Datatype type)
                           throws SAXException
this method is called when the attribute matches the XPath.

Specified by:
onAttributeMatched in class PathMatcher
Throws:
SAXException

startElement

protected void startElement(String namespaceURI,
                            String localName,
                            Attributes attributes)
                     throws SAXException
Throws:
SAXException

endElement

protected void endElement(Datatype type)
                   throws SAXException
Throws:
SAXException

characters

protected void characters(char[] buf,
                          int start,
                          int len)
                   throws SAXException
Throws:
SAXException

getDepth

protected final int getDepth()

onRemoved

protected void onRemoved()
                  throws SAXException
called when this bundle is deactivated. This method is called by the endElement method when this bundle is removed. A derived class can override this method to do whatever necessary.

Throws:
SAXException


MSV