Class AbstractParseState
- java.lang.Object
-
- org.eclipse.birt.core.framework.parser.AbstractParseState
-
- Direct Known Subclasses:
ParseState
public abstract class AbstractParseState extends java.lang.ObjectAbstract parse state for theXMLParserHandlerclass. Derived classes create parse states based on this class.- See Also:
ParseState,AnyElementState
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringcontextSAX context string.protected java.lang.StringelementNameThe name of the element being parsed.protected java.lang.StringBuffertextAccumulates any text that appears within the element tags.
-
Constructor Summary
Constructors Constructor Description AbstractParseState()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidend()Called when the element for this state is ending.voidendElement(AbstractParseState state)Called when a child element is ending.protected java.lang.StringgetAttrib(org.xml.sax.Attributes attrs, java.lang.String attrName)Parse a string value.abstract XMLParserHandlergetHandler()Returns the parser handler.AbstractParseStatejumpTo()Jumps to the specified state that the current state needs to go.voidparseAttrs(org.xml.sax.Attributes attrs)Called to parse attributes.voidsetElementName(java.lang.String name)Sets the element name.AbstractParseStatestartElement(java.lang.String tagName)Start a new tag.
-
-
-
Method Detail
-
setElementName
public void setElementName(java.lang.String name)
Sets the element name.- Parameters:
name- the name of the element.
-
jumpTo
public AbstractParseState jumpTo()
Jumps to the specified state that the current state needs to go.- Returns:
- the other state.
-
parseAttrs
public void parseAttrs(org.xml.sax.Attributes attrs) throws XMLParserExceptionCalled to parse attributes. This is the first method called after the state is created.Returns the value of attribute name.- Parameters:
attrs- the SAX attributes object- Throws:
XMLParserException- if any parse exception- See Also:
DefaultHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
-
startElement
public AbstractParseState startElement(java.lang.String tagName)
Start a new tag. Derived classes override this to create a state to handle the element. Call this method to issue an error for, and ignore, any unrecognized tags.- Parameters:
tagName- the name of the starting element- Returns:
- the state to parse the given tag
- See Also:
DefaultHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
-
getHandler
public abstract XMLParserHandler getHandler()
Returns the parser handler. Required to be implemented by derived states. States will implement this differently depending on whether the state is a normal or inner class.- Returns:
- the XML parser handler
-
endElement
public void endElement(AbstractParseState state)
Called when a child element is ending.- Parameters:
state- the child state that is ending
-
end
public void end() throws org.xml.sax.SAXExceptionCalled when the element for this state is ending.- Throws:
org.xml.sax.SAXException- if the SAX exception is encountered.- See Also:
DefaultHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
-
getAttrib
protected java.lang.String getAttrib(org.xml.sax.Attributes attrs, java.lang.String attrName)Parse a string value. Normalizes the string: blank strings are converted to a null string.- Parameters:
attrs- the SAX attributes objectattrName- the name of the attribute to parse- Returns:
- the parsed string
-
-