Class 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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.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 java.lang.Object value
      the matched value.
      • Fields inherited from class com.sun.msv.verifier.identity.Matcher

        owner
    • Constructor Summary

      Constructors 
      Constructor Description
      FieldMatcher​(FieldsMatcher parent, Field field, java.lang.String namespaceURI, java.lang.String localName)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void characters​(char[] buf, int start, int len)  
      private void doubleMatchError()
      this field matches more than once.
      protected void endElement​(org.relaxng.datatype.Datatype type)  
      protected void onAttributeMatched​(java.lang.String namespaceURI, java.lang.String localName, java.lang.String value, org.relaxng.datatype.Datatype type)
      this method is called when the attribute matches the XPath.
      protected void onElementMatched​(java.lang.String namespaceURI, java.lang.String localName)
      this method is called when the element matches the XPath.
      private void setValue​(java.lang.String lexical, org.relaxng.datatype.Datatype type)
      sets the value field.
      protected void startElement​(java.lang.String namespaceURI, java.lang.String localName, org.xml.sax.Attributes attributes)  
      • 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 java.lang.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 java.lang.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.
    • Constructor Detail

      • FieldMatcher

        FieldMatcher​(FieldsMatcher parent,
                     Field field,
                     java.lang.String namespaceURI,
                     java.lang.String localName)
              throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
    • Method Detail

      • onElementMatched

        protected void onElementMatched​(java.lang.String namespaceURI,
                                        java.lang.String localName)
                                 throws org.xml.sax.SAXException
        this method is called when the element matches the XPath.
        Specified by:
        onElementMatched in class PathMatcher
        Throws:
        org.xml.sax.SAXException
      • onAttributeMatched

        protected void onAttributeMatched​(java.lang.String namespaceURI,
                                          java.lang.String localName,
                                          java.lang.String value,
                                          org.relaxng.datatype.Datatype type)
                                   throws org.xml.sax.SAXException
        this method is called when the attribute matches the XPath.
        Specified by:
        onAttributeMatched in class PathMatcher
        Throws:
        org.xml.sax.SAXException
      • startElement

        protected void startElement​(java.lang.String namespaceURI,
                                    java.lang.String localName,
                                    org.xml.sax.Attributes attributes)
                             throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • endElement

        protected void endElement​(org.relaxng.datatype.Datatype type)
                           throws org.xml.sax.SAXException
        Overrides:
        endElement in class MatcherBundle
        Throws:
        org.xml.sax.SAXException
      • characters

        protected void characters​(char[] buf,
                                  int start,
                                  int len)
                           throws org.xml.sax.SAXException
        Overrides:
        characters in class MatcherBundle
        Throws:
        org.xml.sax.SAXException
      • setValue

        private void setValue​(java.lang.String lexical,
                              org.relaxng.datatype.Datatype type)
                       throws org.xml.sax.SAXException
        sets the value field.
        Throws:
        org.xml.sax.SAXException
      • doubleMatchError

        private void doubleMatchError()
                               throws org.xml.sax.SAXException
        this field matches more than once.
        Throws:
        org.xml.sax.SAXException