public class Parser extends org.xml.sax.helpers.DefaultHandler implements ScanHandler, org.xml.sax.XMLReader, org.xml.sax.ext.LexicalHandler
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
autoDetectorProperty
Specifies the AutoDetector (for encoding detection) this Parser uses.
|
static java.lang.String |
bogonsEmptyFeature
A value of "true" indicates that the parser will give unknown
elements a content model of EMPTY; a value of "false", a
content model of ANY.
|
static java.lang.String |
CDATAElementsFeature
A value of "true" indicates that the parser will treat CDATA
elements specially.
|
static java.lang.String |
defaultAttributesFeature
A value of "true" indicates that the parser will return default
attribute values for missing attributes that have default values.
|
static java.lang.String |
externalGeneralEntitiesFeature
Reports whether this parser processes external general entities
(it doesn't).
|
static java.lang.String |
externalParameterEntitiesFeature
Reports whether this parser processes external parameter entities
(it doesn't).
|
static java.lang.String |
ignorableWhitespaceFeature
A value of "true" indicates that the parser will
transmit whitespace in element-only content via the SAX
ignorableWhitespace callback.
|
static java.lang.String |
ignoreBogonsFeature
A value of "true" indicates that the parser will ignore
unknown elements.
|
static java.lang.String |
isStandaloneFeature
May be examined only during a parse, after the startDocument()
callback has been completed; read-only.
|
static java.lang.String |
lexicalHandlerParameterEntitiesFeature
A value of "true" indicates that the LexicalHandler will report
the beginning and end of parameter entities (it won't).
|
static java.lang.String |
lexicalHandlerProperty
Used to see some syntax events that are essential in some
applications: comments, CDATA delimiters, selected general
entity inclusions, and the start and end of the DTD (and
declaration of document element name).
|
static java.lang.String |
namespacePrefixesFeature
A value of "true" indicates that XML qualified names (with prefixes)
and attributes (including xmlns* attributes) will be available.
|
static java.lang.String |
namespacesFeature
A value of "true" indicates namespace URIs and unprefixed local
names for element and attribute names will be available.
|
static java.lang.String |
resolveDTDURIsFeature
A value of "true" indicates that system IDs in declarations will
be absolutized (relative to their base URIs) before reporting.
|
static java.lang.String |
restartElementsFeature
A value of "true" indicates that the parser will
attempt to restart the restartable elements.
|
static java.lang.String |
rootBogonsFeature
A value of "true" indicates that the parser will allow unknown
elements to be the root element.
|
static java.lang.String |
scannerProperty
Specifies the Scanner object this Parser uses.
|
static java.lang.String |
schemaProperty
Specifies the Schema object this Parser uses.
|
static java.lang.String |
stringInterningFeature
Has a value of "true" if all XML names (for elements,
prefixes, attributes, entities, notations, and local
names), as well as Namespace URIs, will have been interned
using java.lang.String.intern.
|
static java.lang.String |
translateColonsFeature
A value of "true" indicates that the parser will
translate colons into underscores in names.
|
static java.lang.String |
unicodeNormalizationCheckingFeature
Controls whether the parser reports Unicode normalization
errors as described in section 2.13 and Appendix B of the XML
1.1 Recommendation.
|
static java.lang.String |
useAttributes2Feature
Returns "true" if the Attributes objects passed by this
parser in ContentHandler.startElement() implement the
org.xml.sax.ext.Attributes2 interface.
|
static java.lang.String |
useEntityResolver2Feature
Returns "true" if, when setEntityResolver is given an object
implementing the org.xml.sax.ext.EntityResolver2 interface,
those new methods will be used.
|
static java.lang.String |
useLocator2Feature
Returns "true" if the Locator objects passed by this parser
in ContentHandler.setDocumentLocator() implement the
org.xml.sax.ext.Locator2 interface.
|
static java.lang.String |
validationFeature
Controls whether the parser is reporting all validity errors
(We don't report any validity errors.)
|
static java.lang.String |
XML11Feature
Returns "true" if the parser supports both XML 1.1 and XML 1.0.
|
static java.lang.String |
xmlnsURIsFeature
Controls whether, when the namespace-prefixes feature is set,
the parser treats namespace declaration attributes as being in
the http://www.w3.org/2000/xmlns/ namespace.
|
Constructor and Description |
---|
Parser() |
Modifier and Type | Method and Description |
---|---|
void |
adup(char[] buff,
int offset,
int length)
Reports an attribute name without a value.
|
void |
aname(char[] buff,
int offset,
int length)
Reports an attribute name; a value will follow.
|
void |
aval(char[] buff,
int offset,
int length)
Reports an attribute value.
|
void |
cdsect(char[] buff,
int offset,
int length)
Reports the content of a CDATA section (not a CDATA element)
|
void |
cmnt(char[] buff,
int offset,
int length)
Reports a comment.
|
void |
comment(char[] ch,
int start,
int length) |
void |
decl(char[] buff,
int offset,
int length)
Parsing the complete XML Document Type Definition is way too complex,
but for many simple cases we can extract something useful from it.
|
void |
endCDATA() |
void |
endDTD() |
void |
endEntity(java.lang.String name) |
void |
entity(char[] buff,
int offset,
int length)
Reports an entity reference or character reference.
|
void |
eof(char[] buff,
int offset,
int length)
Reports EOF.
|
void |
etag_basic(char[] buff,
int offset,
int length) |
boolean |
etag_cdata(char[] buff,
int offset,
int length) |
void |
etag(char[] buff,
int offset,
int length)
Reports an end-tag.
|
org.xml.sax.ContentHandler |
getContentHandler() |
org.xml.sax.DTDHandler |
getDTDHandler() |
int |
getEntity()
Returns the value of the last entity or character reference reported.
|
org.xml.sax.EntityResolver |
getEntityResolver() |
org.xml.sax.ErrorHandler |
getErrorHandler() |
boolean |
getFeature(java.lang.String name) |
java.lang.Object |
getProperty(java.lang.String name) |
void |
gi(char[] buff,
int offset,
int length)
Reports the general identifier (element type name) of a start-tag.
|
void |
parse(org.xml.sax.InputSource input) |
void |
parse(java.lang.String systemid) |
void |
pcdata(char[] buff,
int offset,
int length)
Reports character content.
|
void |
pi(char[] buff,
int offset,
int length)
Reports the data part of a processing instruction.
|
void |
pitarget(char[] buff,
int offset,
int length)
Reports the target part of a processing instruction.
|
void |
setContentHandler(org.xml.sax.ContentHandler handler) |
void |
setDTDHandler(org.xml.sax.DTDHandler handler) |
void |
setEntityResolver(org.xml.sax.EntityResolver resolver) |
void |
setErrorHandler(org.xml.sax.ErrorHandler handler) |
void |
setFeature(java.lang.String name,
boolean value) |
void |
setProperty(java.lang.String name,
java.lang.Object value) |
void |
stagc(char[] buff,
int offset,
int length)
Reports the close of a start-tag.
|
void |
stage(char[] buff,
int offset,
int length)
Reports the close of an empty-tag.
|
void |
startCDATA() |
void |
startDTD(java.lang.String name,
java.lang.String publicid,
java.lang.String systemid) |
void |
startEntity(java.lang.String name) |
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
public static final java.lang.String namespacesFeature
public static final java.lang.String namespacePrefixesFeature
public static final java.lang.String externalGeneralEntitiesFeature
public static final java.lang.String externalParameterEntitiesFeature
public static final java.lang.String isStandaloneFeature
public static final java.lang.String lexicalHandlerParameterEntitiesFeature
public static final java.lang.String resolveDTDURIsFeature
public static final java.lang.String stringInterningFeature
public static final java.lang.String useAttributes2Feature
public static final java.lang.String useLocator2Feature
public static final java.lang.String useEntityResolver2Feature
public static final java.lang.String validationFeature
public static final java.lang.String unicodeNormalizationCheckingFeature
public static final java.lang.String xmlnsURIsFeature
public static final java.lang.String XML11Feature
public static final java.lang.String ignoreBogonsFeature
public static final java.lang.String bogonsEmptyFeature
public static final java.lang.String rootBogonsFeature
public static final java.lang.String defaultAttributesFeature
public static final java.lang.String translateColonsFeature
public static final java.lang.String restartElementsFeature
public static final java.lang.String ignorableWhitespaceFeature
public static final java.lang.String CDATAElementsFeature
public static final java.lang.String lexicalHandlerProperty
public static final java.lang.String scannerProperty
public static final java.lang.String schemaProperty
public static final java.lang.String autoDetectorProperty
public boolean getFeature(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
getFeature
in interface org.xml.sax.XMLReader
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
public void setFeature(java.lang.String name, boolean value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
setFeature
in interface org.xml.sax.XMLReader
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
public java.lang.Object getProperty(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
getProperty
in interface org.xml.sax.XMLReader
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
public void setProperty(java.lang.String name, java.lang.Object value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
setProperty
in interface org.xml.sax.XMLReader
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
setEntityResolver
in interface org.xml.sax.XMLReader
public org.xml.sax.EntityResolver getEntityResolver()
getEntityResolver
in interface org.xml.sax.XMLReader
public void setDTDHandler(org.xml.sax.DTDHandler handler)
setDTDHandler
in interface org.xml.sax.XMLReader
public org.xml.sax.DTDHandler getDTDHandler()
getDTDHandler
in interface org.xml.sax.XMLReader
public void setContentHandler(org.xml.sax.ContentHandler handler)
setContentHandler
in interface org.xml.sax.XMLReader
public org.xml.sax.ContentHandler getContentHandler()
getContentHandler
in interface org.xml.sax.XMLReader
public void setErrorHandler(org.xml.sax.ErrorHandler handler)
setErrorHandler
in interface org.xml.sax.XMLReader
public org.xml.sax.ErrorHandler getErrorHandler()
getErrorHandler
in interface org.xml.sax.XMLReader
public void parse(org.xml.sax.InputSource input) throws java.io.IOException, org.xml.sax.SAXException
parse
in interface org.xml.sax.XMLReader
java.io.IOException
org.xml.sax.SAXException
public void parse(java.lang.String systemid) throws java.io.IOException, org.xml.sax.SAXException
parse
in interface org.xml.sax.XMLReader
java.io.IOException
org.xml.sax.SAXException
public void adup(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
adup
in interface ScanHandler
org.xml.sax.SAXException
public void aname(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
aname
in interface ScanHandler
org.xml.sax.SAXException
public void aval(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
aval
in interface ScanHandler
org.xml.sax.SAXException
public void entity(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
entity
in interface ScanHandler
org.xml.sax.SAXException
public void eof(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
eof
in interface ScanHandler
org.xml.sax.SAXException
public void etag(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
etag
in interface ScanHandler
org.xml.sax.SAXException
public boolean etag_cdata(char[] buff, int offset, int length) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void etag_basic(char[] buff, int offset, int length) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void decl(char[] buff, int offset, int length) throws org.xml.sax.SAXException
decl
in interface ScanHandler
org.xml.sax.SAXException
public void gi(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
gi
in interface ScanHandler
org.xml.sax.SAXException
public void cdsect(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
cdsect
in interface ScanHandler
org.xml.sax.SAXException
public void pcdata(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
pcdata
in interface ScanHandler
org.xml.sax.SAXException
public void pitarget(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
pitarget
in interface ScanHandler
org.xml.sax.SAXException
public void pi(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
pi
in interface ScanHandler
org.xml.sax.SAXException
public void stagc(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
stagc
in interface ScanHandler
org.xml.sax.SAXException
public void stage(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
stage
in interface ScanHandler
org.xml.sax.SAXException
public void cmnt(char[] buff, int offset, int length) throws org.xml.sax.SAXException
ScanHandler
cmnt
in interface ScanHandler
org.xml.sax.SAXException
public int getEntity()
ScanHandler
getEntity
in interface ScanHandler
public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
comment
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void endCDATA() throws org.xml.sax.SAXException
endCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void endDTD() throws org.xml.sax.SAXException
endDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void endEntity(java.lang.String name) throws org.xml.sax.SAXException
endEntity
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void startCDATA() throws org.xml.sax.SAXException
startCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void startDTD(java.lang.String name, java.lang.String publicid, java.lang.String systemid) throws org.xml.sax.SAXException
startDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void startEntity(java.lang.String name) throws org.xml.sax.SAXException
startEntity
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
Licence: Academic Free License 3.0 and/or GPL 2.0