|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.helpers.DefaultHandler | +--org.jdom.input.SAXHandler
SAXHandler
supports SAXBuilder
Constructor Summary | |
SAXHandler()
This will create a new SAXHandler that listens to SAX
events and creates a JDOM Document. |
|
SAXHandler(Document document)
Deprecated. Deprecated in beta7, use SAXHandler() instead and let SAXHandler create the Document, then retrieve it with getDocument() |
|
SAXHandler(JDOMFactory factory)
This will create a new SAXHandler that listens to SAX
events and creates a JDOM Document. |
Method Summary | |
void |
attributeDecl(String eName,
String aName,
String type,
String valueDefault,
String value)
|
void |
characters(char[] ch,
int start,
int length)
This will report character data (within an element). |
void |
comment(char[] ch,
int start,
int length)
This reports that a comments is parsed. |
void |
elementDecl(String name,
String model)
|
void |
endCDATA()
Report a CDATA section - ignored in SAXBuilder. |
void |
endDTD()
This signifies that the reading of the DTD is complete. |
void |
endElement(String namespaceURI,
String localName,
String qName)
Indicates the end of an element ( </[element name]> ) is reached. |
void |
endEntity(String name)
|
void |
endPrefixMapping(String prefix)
This will add the prefix mapping to the JDOM Document object. |
void |
externalEntityDecl(String name,
String publicId,
String systemId)
This is called when the parser encounters an external entity declaration. |
Document |
getDocument()
Returns the document. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Capture ignorable whitespace as text. |
void |
internalEntityDecl(String name,
String value)
|
void |
processingInstruction(String target,
String data)
This will indicate that a processing instruction (other than the XML declaration) has been encountered. |
void |
setExpandEntities(boolean expand)
This sets whether or not to expand entities during the build. |
void |
setIgnoringElementContentWhitespace(boolean ignoringWhite)
Specifies whether or not the parser should elminate whitespace in element content (sometimes known as "ignorable whitespace") when building the document. |
void |
startCDATA()
Report a CDATA section - ignored in SAXBuilder. |
void |
startDTD(String name,
String publicId,
String systemId)
This will signify that a DTD is being parsed, and can be used to ensure that comments and other lexical structures in the DTD are not added to the JDOM Document
object. |
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
This reports the occurrence of an actual element. |
void |
startEntity(String name)
|
void |
startPrefixMapping(String prefix,
String uri)
This will add the prefix mapping to the JDOM Document object. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
endDocument,
error,
fatalError,
notationDecl,
resolveEntity,
setDocumentLocator,
skippedEntity,
startDocument,
unparsedEntityDecl,
warning |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public SAXHandler(Document document) throws IOException
This will set the Document
to use.
document
- Document
being parsed.public SAXHandler() throws IOException
This will create a new SAXHandler
that listens to SAX
events and creates a JDOM Document. The objects will be constructed
using the default factory.
public SAXHandler(JDOMFactory factory) throws IOException
This will create a new SAXHandler
that listens to SAX
events and creates a JDOM Document. The objects will be constructed
using the provided factory.
factory
- JDOMFactory
to be used for constructing
objectsMethod Detail |
public Document getDocument()
Returns the document. Should be called after parsing is complete.
Document
- Document that was builtpublic void setExpandEntities(boolean expand)
This sets whether or not to expand entities during the build.
A true means to expand entities as normal content. A false means to
leave entities unexpanded as EntityRef
objects. The
default is true.
expand
- boolean
indicating whether entity expansion
should occur.public void setIgnoringElementContentWhitespace(boolean ignoringWhite)
Specifies whether or not the parser should elminate whitespace in
element content (sometimes known as "ignorable whitespace") when
building the document. Only whitespace which is contained within
element content that has an element only content model will be
eliminated (see XML Rec 3.2.1). For this setting to take effect
requires that validation be turned on. The default value of this
setting is false
.
ignoringWhite
- Whether to ignore ignorable whitespacepublic void externalEntityDecl(String name, String publicId, String systemId) throws SAXException
name
- entity namepublicId
- public idsystemId
- system idpublic void attributeDecl(String eName, String aName, String type, String valueDefault, String value)
public void elementDecl(String name, String model)
public void internalEntityDecl(String name, String value)
public void processingInstruction(String target, String data) throws SAXException
This will indicate that a processing instruction (other than the XML declaration) has been encountered.
target
- String
target of PIdata
- String
Throws:public void startPrefixMapping(String prefix, String uri) throws SAXException
This will add the prefix mapping to the JDOM
Document
object.
prefix
- String
namespace prefix.uri
- String
namespace URI.public void endPrefixMapping(String prefix) throws SAXException
This will add the prefix mapping to the JDOM
Document
object.
prefix
- String
namespace prefix.uri
- String
namespace URI.public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
This reports the occurrence of an actual element. It will include
the element's attributes, with the exception of XML vocabulary
specific attributes, such as
xmlns:[namespace prefix]
and
xsi:schemaLocation
.
namespaceURI
- String
namespace URI this element
is associated with, or an empty
String
localName
- String
name of element (with no
namespace prefix, if one is present)qName
- String
XML 1.0 version of element name:
[namespace prefix]:[localName]atts
- Attributes
list for this elementpublic void characters(char[] ch, int start, int length) throws SAXException
This will report character data (within an element).
ch
- char[]
character array with character datastart
- int
index in array where data starts.length
- int
length of data.public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
Capture ignorable whitespace as text. If setIgnoringElementContentWhitespace(true) has been called then this method does nothing.
ch
- []
- char array of ignorable whitespacestart
- int
- starting position within arraylength
- int
- length of whitespace after startpublic void endElement(String namespaceURI, String localName, String qName) throws SAXException
Indicates the end of an element
(</[element name]>
) is reached. Note that
the parser does not distinguish between empty
elements and non-empty elements, so this will occur uniformly.
namespaceURI
- String
URI of namespace this
element is associated withlocalName
- String
name of element without prefixqName
- String
name of element in XML 1.0 formpublic void startDTD(String name, String publicId, String systemId) throws SAXException
This will signify that a DTD is being parsed, and can be
used to ensure that comments and other lexical structures
in the DTD are not added to the JDOM Document
object.
name
- String
name of element listed in DTDpublicId
- String
public ID of DTDsystemId
- String
syste ID of DTDpublic void endDTD() throws SAXException
This signifies that the reading of the DTD is complete.
public void startEntity(String name) throws SAXException
public void endEntity(String name) throws SAXException
public void startCDATA() throws SAXException
Report a CDATA section - ignored in SAXBuilder.
public void endCDATA() throws SAXException
Report a CDATA section - ignored in SAXBuilder.
public void comment(char[] ch, int start, int length) throws SAXException
This reports that a comments is parsed. If not in the
DTD, this comment is added to the current JDOM
Element
, or the Document
itself
if at that level.
ch
- ch[]
array of comment characters.start
- int
index to start reading from.length
- int
length of data.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |