|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--util.XMLUtilsBean
A JavaBean which uses SAX2 for extracting data from an XML file. The SAX2 callbacks are defined within local classes inside of the bean's getter methods. The general structure is as follows:
public class XMLUtilsBean { ...private fields... ...public constructor... public String[] getXXX() { ...local vars... class Handler extends DefaultHandler { ...SAX 2.0 callbacks... } ...parsing operations... ...Handler, ErrHandler referenced here... } class ErrHandler extends DefaultHandler { ... } }
Constructor Summary | |
XMLUtilsBean()
Requisite no-argument constructor. |
Method Summary | |
java.lang.String |
getAttName()
Retrieves the name of the desired XML tag attribute name. |
java.lang.String[] |
getAttValsByElement()
Returns all attribute values for a given element name and having a given attribute name. |
java.lang.String |
getAttValue()
Retrieves the name of the desired XML tag attribute value. |
java.lang.String[] |
getData()
Returns the (#PCDATA) from all XML elements
with the given element tag name. |
java.lang.String[] |
getDataByAttValPair()
Returns the (#PCDATA) from all XML elements
having a given attribute name-value pair. |
java.lang.String |
getElementName()
Retrieves the name of the desired XML tag. |
java.lang.String |
getXMLFileName()
Retrieves the name of the XML file being processed. |
void |
setAttName(java.lang.String name)
Sets the name of the desired XML tag attribute name. |
void |
setAttValue(java.lang.String name)
Sets the name of the desired XML tag attribute value. |
void |
setElementName(java.lang.String name)
Sets the name of the desired XML tag. |
void |
setXMLFileName(java.lang.String name)
Sets the name of the XML file to be processed. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public XMLUtilsBean()
XMLFileName
to "NOT_SET"
.
All getXXX
methods check if XMLFileName
is "NOT_SET"
. If so, an
IOException
is thrown, if not,
XMLReader.parse(InputSource XMLFileName)
is invoked.Method Detail |
public java.lang.String getXMLFileName()
String
containing the name of the XML file
being parsed.setXMLFileName(java.lang.String)
public void setXMLFileName(java.lang.String name)
<jsp:setProperty>
bean tag
in a JSP page.name
- A String
containing the name of the
XML file.public java.lang.String getElementName()
String
containing the name of the XML tag.setElementName(java.lang.String)
public void setElementName(java.lang.String name)
<jsp:setProperty>
bean tag
in a JSP page.name
- A String
containing the name of the
XML element namepublic java.lang.String getAttName()
String
containing the name of the XML tag
attribute.setAttName(java.lang.String)
public void setAttName(java.lang.String name)
<jsp:setProperty>
bean tag
in a JSP page.name
- A String
containing the name of the XML tag
attribute name.public java.lang.String getAttValue()
String
containing the name of the XML
tag attribute value.setAttValue(java.lang.String)
public void setAttValue(java.lang.String name)
<jsp:setProperty>
bean tag
in a JSP page.name
- A String
containing the name of the XML tag
attribute value.public java.lang.String[] getData() throws org.xml.sax.SAXException
(#PCDATA)
from all XML elements
with the given element tag name. Since this method references
the element name, that value is typically set prior to its
usage via setElementName(java.lang.String)
or using a
<jsp:setProperty>
bean tag in a JSP page.String
array containing the datasetElementName(java.lang.String)
public java.lang.String[] getAttValsByElement() throws org.xml.sax.SAXException
setElementName(java.lang.String)
and
setAttName(java.lang.String)
or using a
<jsp:setProperty>
bean
tag in a JSP page.String
array containing the datasetElementName(java.lang.String)
,
setAttName(java.lang.String)
public java.lang.String[] getDataByAttValPair() throws org.xml.sax.SAXException
(#PCDATA)
from all XML elements
having a given attribute name-value pair. Since this method
references
both an attribute name and value, those values are
typically set prior to its usage via setAttName(java.lang.String)
and
setAttValue(java.lang.String)
or using a
<jsp:setProperty>
bean
tag in a JSP page.String
array containing the datasetAttName(java.lang.String)
,
setAttValue(java.lang.String)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |