Package com.sun.msv.verifier.identity
Class FieldMatcher
- java.lang.Object
-
- com.sun.msv.verifier.identity.Matcher
-
- com.sun.msv.verifier.identity.MatcherBundle
-
- com.sun.msv.verifier.identity.PathMatcher
-
- 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.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringBufferelementTextthis field is set to non-null if it's found that an element is matched to this XPath.protected Fieldfieldprotected FieldsMatcherparentparent FieldsMatcher object.protected java.lang.Objectvaluethe matched value.-
Fields inherited from class com.sun.msv.verifier.identity.MatcherBundle
children
-
-
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 voidcharacters(char[] buf, int start, int len)private voiddoubleMatchError()this field matches more than once.protected voidendElement(org.relaxng.datatype.Datatype type)protected voidonAttributeMatched(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 voidonElementMatched(java.lang.String namespaceURI, java.lang.String localName)this method is called when the element matches the XPath.private voidsetValue(java.lang.String lexical, org.relaxng.datatype.Datatype type)sets the value field.protected voidstartElement(java.lang.String namespaceURI, java.lang.String localName, org.xml.sax.Attributes attributes)-
Methods inherited from class com.sun.msv.verifier.identity.PathMatcher
onAttribute, start, startElement
-
Methods inherited from class com.sun.msv.verifier.identity.MatcherBundle
getDepth, onRemoved
-
-
-
-
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.SAXExceptionthis method is called when the element matches the XPath.- Specified by:
onElementMatchedin classPathMatcher- 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.SAXExceptionthis method is called when the attribute matches the XPath.- Specified by:
onAttributeMatchedin classPathMatcher- 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:
endElementin classMatcherBundle- Throws:
org.xml.sax.SAXException
-
characters
protected void characters(char[] buf, int start, int len) throws org.xml.sax.SAXException- Overrides:
charactersin classMatcherBundle- Throws:
org.xml.sax.SAXException
-
setValue
private void setValue(java.lang.String lexical, org.relaxng.datatype.Datatype type) throws org.xml.sax.SAXExceptionsets the value field.- Throws:
org.xml.sax.SAXException
-
doubleMatchError
private void doubleMatchError() throws org.xml.sax.SAXExceptionthis field matches more than once.- Throws:
org.xml.sax.SAXException
-
-