Package net.n3.nanoxml
Class StdXMLParser
java.lang.Object
net.n3.nanoxml.StdXMLParser
- All Implemented Interfaces:
IXMLParser
StdXMLParser is the core parser of NanoXML.
- Version:
- $Name: RELEASE_2_2_1 $, $Revision: 1.5 $
- Author:
- Marc De Scheemaecker
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
finalize()
Cleans up the object when it's destroyed.Returns the builder which creates the logical structure of the XML data.Returns the reader from which the parser retrieves its data.Returns the entity resolver.Returns the validator that validates the XML data.parse()
Parses the data and lets the builder create the logical data structure.protected void
processAttribute
(Vector attrNames, Vector attrValues, Vector attrTypes) Processes an attribute of an element.protected void
Processes a CDATA section.protected void
Processes a document type declaration.protected void
processElement
(String defaultNamespace, Properties namespaces) Processes a regular element.protected void
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, String defaultNamespace, Properties namespaces) 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.
-
Constructor Details
-
StdXMLParser
public StdXMLParser()Creates a new parser.
-
-
Method Details
-
finalize
Cleans up the object when it's destroyed. -
setBuilder
Sets the builder which creates the logical structure of the XML data.- Specified by:
setBuilder
in interfaceIXMLParser
- Parameters:
builder
- the non-null builder
-
getBuilder
Returns the builder which creates the logical structure of the XML data.- Specified by:
getBuilder
in interfaceIXMLParser
- Returns:
- the builder
-
setValidator
Sets the validator that validates the XML data.- Specified by:
setValidator
in interfaceIXMLParser
- Parameters:
validator
- the non-null validator
-
getValidator
Returns the validator that validates the XML data.- Specified by:
getValidator
in interfaceIXMLParser
- Returns:
- the validator
-
setResolver
Sets the entity resolver.- Specified by:
setResolver
in interfaceIXMLParser
- Parameters:
resolver
- the non-null resolver
-
getResolver
Returns the entity resolver.- Specified by:
getResolver
in interfaceIXMLParser
- Returns:
- the non-null resolver
-
setReader
Sets the reader from which the parser retrieves its data.- Specified by:
setReader
in interfaceIXMLParser
- Parameters:
reader
- the reader
-
getReader
Returns the reader from which the parser retrieves its data.- Specified by:
getReader
in interfaceIXMLParser
- Returns:
- the reader
-
parse
Parses the data and lets the builder create the logical data structure.- Specified by:
parse
in interfaceIXMLParser
- Returns:
- the logical structure built by the builder
- Throws:
XMLException
- if an error occurred reading or parsing the data- See Also:
-
scanData
Scans the XML data for elements.- Throws:
Exception
- if something went wrong
-
scanSomeTag
protected void scanSomeTag(boolean allowCDATA, String defaultNamespace, Properties namespaces) throws Exception Scans an XML tag.- Parameters:
allowCDATA
- true if CDATA sections are allowed at this pointdefaultNamespace
- the default namespace URI (or null)namespaces
- list of defined namespaces- Throws:
Exception
- if something went wrong
-
processPI
Processes a "processing instruction".- Throws:
Exception
- if something went wrong
-
processSpecialTag
Processes a tag that starts with a bang (<!...>).- Parameters:
allowCDATA
- true if CDATA sections are allowed at this point- Throws:
Exception
- if something went wrong
-
processCDATA
Processes a CDATA section.- Throws:
Exception
- if something went wrong
-
processDocType
Processes a document type declaration.- Throws:
Exception
- if an error occurred reading or parsing the data
-
processElement
Processes a regular element.- Parameters:
defaultNamespace
- the default namespace URI (or null)namespaces
- list of defined namespaces- Throws:
Exception
- if something went wrong
-
processAttribute
protected void processAttribute(Vector attrNames, Vector attrValues, Vector attrTypes) throws Exception Processes an attribute of an element.- Parameters:
attrNames
- contains the names of the attributes.attrValues
- contains the values of the attributes.attrTypes
- contains the types of the attributes.- Throws:
Exception
- if something went wrong
-