public class StdXMLParser extends java.lang.Object implements IXMLParser
Modifier and Type | Field and Description |
---|---|
private IXMLBuilder |
builder
The builder which creates the logical structure of the XML data.
|
private static char[] |
END_OF_CDATA
Delimiter for CDATA sections.
|
private static char[] |
END_OF_PCDATA
Delimiter for PCDATA elements.
|
private static char[] |
END_OF_PI
Delimiter for a processing instructions.
|
private IXMLEntityResolver |
entityResolver
The entity resolver.
|
private IXMLReader |
reader
The reader from which the parser retrieves its data.
|
private IXMLValidator |
validator
The validator that will process entity references and validate the XML data.
|
Constructor and Description |
---|
StdXMLParser()
Creates a new parser.
|
Modifier and Type | Method and Description |
---|---|
protected void |
finalize()
Cleans up the object when it's destroyed.
|
IXMLBuilder |
getBuilder()
Returns the builder which creates the logical structure of the XML data.
|
IXMLReader |
getReader()
Returns the reader from which the parser retrieves its data.
|
IXMLEntityResolver |
getResolver()
Returns the entity resolver.
|
IXMLValidator |
getValidator()
Returns the validator that validates the XML data.
|
java.lang.Object |
parse()
Parses the data and lets the builder create the logical data structure.
|
protected void |
processAttribute()
Processes an attribute of an element.
|
protected void |
processCDATA()
Processes a CDATA section.
|
protected void |
processDocType()
Processes a document type declaration.
|
protected void |
processElement()
Processes a regular element.
|
protected void |
processPI()
Processes a "processing instruction".
|
protected void |
processSpecialTag(boolean allowCDATA)
Processes a tag that starts with a bang (<!...>).
|
protected void |
scanData()
Scans the XML data for elements.
|
protected void |
scanSomeTag(boolean allowCDATA)
Scans an XML tag.
|
void |
setBuilder(IXMLBuilder builder)
Sets the builder which creates the logical structure of the XML data.
|
void |
setReader(IXMLReader reader)
Sets the reader from which the parser retrieves its data.
|
void |
setResolver(IXMLEntityResolver resolver)
Sets the entity resolver.
|
void |
setValidator(IXMLValidator validator)
Sets the validator that validates the XML data.
|
private static final char[] END_OF_PI
private static final char[] END_OF_CDATA
private static final char[] END_OF_PCDATA
private IXMLBuilder builder
private IXMLReader reader
private IXMLEntityResolver entityResolver
private IXMLValidator validator
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void setBuilder(IXMLBuilder builder)
setBuilder
in interface IXMLParser
builder
- the non-null builderpublic IXMLBuilder getBuilder()
getBuilder
in interface IXMLParser
public void setValidator(IXMLValidator validator)
setValidator
in interface IXMLParser
validator
- the non-null validatorpublic IXMLValidator getValidator()
getValidator
in interface IXMLParser
public void setResolver(IXMLEntityResolver resolver)
setResolver
in interface IXMLParser
resolver
- the non-null resolverpublic IXMLEntityResolver getResolver()
getResolver
in interface IXMLParser
public void setReader(IXMLReader reader)
setReader
in interface IXMLParser
reader
- the readerpublic IXMLReader getReader()
getReader
in interface IXMLParser
public java.lang.Object parse() throws XMLException
parse
in interface IXMLParser
XMLException
- if an error occurred reading or parsing the dataprotected void scanData() throws java.lang.Exception
java.lang.Exception
- if something went wrongprotected void scanSomeTag(boolean allowCDATA) throws java.lang.Exception
allowCDATA
- true if CDATA sections are allowed at this pointjava.lang.Exception
- if something went wrongprotected void processPI() throws java.lang.Exception
java.lang.Exception
- if something went wrongprotected void processSpecialTag(boolean allowCDATA) throws java.lang.Exception
allowCDATA
- true if CDATA sections are allowed at this pointjava.lang.Exception
- if something went wrongprotected void processCDATA() throws java.lang.Exception
java.lang.Exception
- if something went wrongprotected void processDocType() throws java.lang.Exception
java.lang.Exception
- if an error occurred reading or parsing the dataprotected void processElement() throws java.lang.Exception
java.lang.Exception
- if something went wrongprotected void processAttribute() throws java.lang.Exception
java.lang.Exception
- if something went wrong