public class IlpSAXAttributeValueHandler extends IlpAbstractChainedSAXHandler
This class is used to retrieve the values of attributes in an XML file or stream.
The values may be default values of attributes, or the values of attributes of an instance.
By default, the value of an attribute is directly the text of the attribute element converted to the "right" class.
This class may either be specified in the XML file or come from the
IlpAttribute
.
To change this behavior, you can derive this class and provide your custom
implementation for your attribute classes or IlpAttribute
using the
IlpSAXSerializable
interface.
IlpSAXSerializable
Modifier and Type | Class and Description |
---|---|
static interface |
IlpSAXAttributeValueHandler.ResultHandler
Internal use only !
|
Constructor and Description |
---|
IlpSAXAttributeValueHandler() |
Modifier and Type | Method and Description |
---|---|
void |
endElement(String namespaceURI,
String localName,
String qName)
Notifies that the end of an element is reached.
|
protected Object |
getAttributeValue()
This method is called at the end of the
finalTag element. |
protected String |
getFinalTag()
Returns the tag used to finalize the element.
|
protected IlpSAXAttributeValueHandler.ResultHandler |
getResultHandler()
Returns the result handler.
|
Class |
getTargetClass()
Returns the target class.
|
IlpTypeConverter |
getTypeConverter()
Returns the type converter.
|
protected boolean |
isNull()
Returns
true if the result is null . |
void |
readValue(IlpAbstractSAXHandler parent,
String finalTag,
IlpSAXAttributeValueHandler.ResultHandler resultHandler,
Class targetClass,
IlpTypeConverter typeConverter) |
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
Notifies the beginning of an element.
|
getLocator, getLogger, getParent, getXMLReader, setParent
characters, checkState, clearContent, clearState, error, fatalError, getContent, getState, ignoreUntil, log, logIgnoreElement, processSAXParseException, removeState, setState, throwSAXParseException, warning
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
public Class getTargetClass()
javaClass
)
XML attribute, or comes from IlpAttribute
(see IlpAttribute.getValueClass()
.public IlpTypeConverter getTypeConverter()
protected boolean isNull()
true
if the result is null
.protected String getFinalTag()
protected IlpSAXAttributeValueHandler.ResultHandler getResultHandler()
public void readValue(IlpAbstractSAXHandler parent, String finalTag, IlpSAXAttributeValueHandler.ResultHandler resultHandler, Class targetClass, IlpTypeConverter typeConverter)
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
null
XML attribute and
clears the content of the element.
If you redefine this method, take care of always calling this implementation.startElement
in interface ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
resultHandler.setAttributeValue
method is called and the parsing continues with the parent contentHandler
.
If you redefine this method, make sure you always call this implementation.endElement
in interface ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
SAXException
protected Object getAttributeValue()
finalTag
element.
By default, it converts the content to the target class
using the type converter. It is not even called if isNull()
returns true
; that is, if the null XML
attribute was set to true.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.