public abstract class ParseResult
{
+ public static final String TAG_FIELD_NAME = "TAG";
+
Stack<CurrentInfo> m_current; // Name of the element that we're currently inside
StringBuilder m_chars; // character content of m_current.peek()
ArrayList<ParseResult> m_childParsers; // Set of all child parsers
ParseResult[] result = new ParseResult[collection.size()];
return collection.toArray(result);
}
-
+
// returns true if this ParseResult's context has ended with this endElement() call
public boolean endElement(String uri, String localName, String qName) throws XmlParseException
{
// Default implementation is a no-op.
// Override if you want to validate on endElement()
}
+
+ protected String getRequiredAttr(String tagName, Attributes attr, String attrName)
+ throws MissingAttributeException
+ {
+ String result = attr.getValue(attrName);
+ if (null == result) {
+ throw new MissingAttributeException(tagName, attrName);
+ }
+ return result;
+ }
+
+ protected String getOptionalAttr(Attributes attr, String attrName, String defaultValue)
+ {
+ String value = attr.getValue(attrName);
+ if (null == value) {
+ return defaultValue;
+ }
+ return value;
+ }
}