|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
com.sun.rowset.internal.XmlReaderContentHandler
public class XmlReaderContentHandler
The document handler that receives parse events that an XML parser sends while it
is parsing an XML document representing a WebRowSet
object. The
parser sends strings to this XmlReaderContentHandler
and then uses
these strings as arguments for the XmlReaderContentHandler
methods
it invokes. The final goal of the SAX parser working with an
XmlReaderContentHandler
object is to read an XML document that represents
a RowSet
object.
A rowset consists of its properties, metadata, and data values. An XML document representating a rowset includes the values in these three categories along with appropriate XML tags to identify them. It also includes a top-level XML tag for the rowset and three section tags identifying the three categories of values.
The tags in an XML document are hierarchical.
This means that the top-level tag, RowSet
, is
followed by the three sections with appropriate tags, which are in turn each
followed by their constituent elements. For example, the properties
element will be followed by an element for each of the properties listed in
in this XmlReaderContentHandler
object's properties
field. The content of the other two fields, colDef
, which lists
the rowset's metadata elements, and data
, which lists the rowset's data
elements, are handled similarly .
This implementation of XmlReaderContentHandler
provides the means for the
parser to determine which elements need to have a value set and then to set
those values. The methods in this class are all called by the parser; an
application programmer never calls them directly.
Constructor Summary | |
---|---|
XmlReaderContentHandler(javax.sql.RowSet r)
Constructs a new XmlReaderContentHandler object that will
assist the SAX parser in reading a WebRowSet object in the
format of an XML document. |
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
Sets a property, metadata, or data value with the characters in the given array of characters, starting with the array element indicated by start and continuing for length
number of characters. |
void |
endDocument()
|
void |
endElement(java.lang.String uri,
java.lang.String lName,
java.lang.String qName)
Sets the value for the given element if name is one of
the array elements in the fields properties ,
colDef , or data and this
XmlReaderContentHandler object's state is not
INITIAL . |
void |
error(org.xml.sax.SAXParseException e)
Throws the given SAXParseException object. |
void |
notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
|
void |
startDocument()
|
void |
startElement(java.lang.String uri,
java.lang.String lName,
java.lang.String qName,
org.xml.sax.Attributes attributes)
Sets this XmlReaderContentHandler object's tag
field if the given name is the key for a tag and this object's state
is not INITIAL . |
void |
unparsedEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName)
|
void |
warning(org.xml.sax.SAXParseException err)
Prints a warning message to System.out giving the line
number and uri for what caused the warning plus a message explaining
the reason for the warning. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
endPrefixMapping, fatalError, ignorableWhitespace, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlReaderContentHandler(javax.sql.RowSet r)
XmlReaderContentHandler
object that will
assist the SAX parser in reading a WebRowSet
object in the
format of an XML document. In addition to setting some default values,
this constructor creates three HashMap
objects, one for
properties, one for metadata, and one for data. These hash maps map the
strings sent by the SAX parser to integer constants so that they can be
compared more efficiently in switch
statements.
r
- the RowSet
object in XML format that will be readMethod Detail |
---|
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void startElement(java.lang.String uri, java.lang.String lName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
XmlReaderContentHandler
object's tag
field if the given name is the key for a tag and this object's state
is not INITIAL
. The field is set
to the constant that corresponds to the given element name.
If the state is INITIAL
, the state is set to the given
name, which will be one of the sections PROPERTIES
,
METADATA
, or DATA
. In either case, this
method puts this document handler in the proper state for calling
the method endElement
.
If the state is DATA
and the tag is RowTag
,
DelTag
, or InsTag
, this method moves the
rowset's cursor to the insert row and sets this
XmlReaderContentHandler
object's idx
field to 0
so that it will be in the proper
state when the parser calls the method endElement
.
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
name
- the name of the element; either (1) one of the array
elements in the fields properties
,
colDef
, or data
or
(2) one of the RowSet
elements
"properties"
, "metadata"
, or
"data"
attributes
- org.xml.sax.AttributeList
objects that are
attributes of the named section element; may be null
if there are no attributes, which is the case for
WebRowSet
objects
org.xml.sax.SAXException
- if a general SAX error occurspublic void endElement(java.lang.String uri, java.lang.String lName, java.lang.String qName) throws org.xml.sax.SAXException
name
is one of
the array elements in the fields properties
,
colDef
, or data
and this
XmlReaderContentHandler
object's state is not
INITIAL
. If the state is INITIAL
,
this method does nothing.
If the state is METADATA
and
the argument supplied is "metadata"
, the rowset's
metadata is set. If the state is PROPERTIES
, the
appropriate property is set using the given name to determine
the appropriate value. If the state is DATA
and
the argument supplied is "data"
, this method sets
the state to INITIAL
and returns. If the argument
supplied is one of the elements in the field data
,
this method makes the appropriate changes to the rowset's data.
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
name
- the name of the element; either (1) one of the array
elements in the fields properties
,
colDef
, or data
or
(2) one of the RowSet
elements
"properties"
, "metadata"
, or
"data"
org.xml.sax.SAXException
- if a general SAX error occurspublic void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
start
and continuing for length
number of characters.
The SAX parser invokes this method and supplies the character array, start position, and length parameter values it got from parsing the XML document. An application programmer never invokes this method directly.
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
ch
- an array of characters supplied by the SAX parser, all or part of
which will be used to set a valuestart
- the position in the given array at which to startlength
- the number of consecutive characters to use
org.xml.sax.SAXException
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXParseException
SAXParseException
object. This
exception was originally thrown by the SAX parser and is passed
to the method error
when the SAX parser invokes it.
error
in interface org.xml.sax.ErrorHandler
error
in class org.xml.sax.helpers.DefaultHandler
e
- the SAXParseException
object to throw
org.xml.sax.SAXParseException
public void warning(org.xml.sax.SAXParseException err) throws org.xml.sax.SAXParseException
System.out
giving the line
number and uri for what caused the warning plus a message explaining
the reason for the warning. This method is invoked by the SAX parser.
warning
in interface org.xml.sax.ErrorHandler
warning
in class org.xml.sax.helpers.DefaultHandler
err
- a warning generated by the SAX parser
org.xml.sax.SAXParseException
public void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
notationDecl
in interface org.xml.sax.DTDHandler
notationDecl
in class org.xml.sax.helpers.DefaultHandler
public void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName)
unparsedEntityDecl
in interface org.xml.sax.DTDHandler
unparsedEntityDecl
in class org.xml.sax.helpers.DefaultHandler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |