net.n3.nanoxml

Class StdXMLParser

public class StdXMLParser extends Object implements IXMLParser

StdXMLParser is the core parser of NanoXML.

Version: $Name: RELEASE_2_2_1 $, $Revision: 1.5 $

Author: Marc De Scheemaecker

Constructor Summary
StdXMLParser()
Creates a new parser.
Method Summary
protected voidfinalize()
Cleans up the object when it's destroyed.
IXMLBuildergetBuilder()
Returns the builder which creates the logical structure of the XML data.
IXMLReadergetReader()
Returns the reader from which the parser retrieves its data.
IXMLEntityResolvergetResolver()
Returns the entity resolver.
IXMLValidatorgetValidator()
Returns the validator that validates the XML data.
Objectparse()
Parses the data and lets the builder create the logical data structure.
protected voidprocessAttribute(Vector attrNames, Vector attrValues, Vector attrTypes)
Processes an attribute of an element.
protected voidprocessCDATA()
Processes a CDATA section.
protected voidprocessDocType()
Processes a document type declaration.
protected voidprocessElement(String defaultNamespace, Properties namespaces)
Processes a regular element.
protected voidprocessPI()
Processes a "processing instruction".
protected voidprocessSpecialTag(boolean allowCDATA)
Processes a tag that starts with a bang (<!
protected voidscanData()
Scans the XML data for elements.
protected voidscanSomeTag(boolean allowCDATA, String defaultNamespace, Properties namespaces)
Scans an XML tag.
voidsetBuilder(IXMLBuilder builder)
Sets the builder which creates the logical structure of the XML data.
voidsetReader(IXMLReader reader)
Sets the reader from which the parser retrieves its data.
voidsetResolver(IXMLEntityResolver resolver)
Sets the entity resolver.
voidsetValidator(IXMLValidator validator)
Sets the validator that validates the XML data.

Constructor Detail

StdXMLParser

public StdXMLParser()
Creates a new parser.

Method Detail

finalize

protected void finalize()
Cleans up the object when it's destroyed.

getBuilder

public IXMLBuilder getBuilder()
Returns the builder which creates the logical structure of the XML data.

Returns: the builder

getReader

public IXMLReader getReader()
Returns the reader from which the parser retrieves its data.

Returns: the reader

getResolver

public IXMLEntityResolver getResolver()
Returns the entity resolver.

Returns: the non-null resolver

getValidator

public IXMLValidator getValidator()
Returns the validator that validates the XML data.

Returns: the validator

parse

public Object parse()
Parses the data and lets the builder create the logical data structure.

Returns: the logical structure built by the builder

Throws: net.n3.nanoxml.XMLException if an error occurred reading or parsing the data

processAttribute

protected void processAttribute(Vector attrNames, Vector attrValues, Vector attrTypes)
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: java.lang.Exception if something went wrong

processCDATA

protected void processCDATA()
Processes a CDATA section.

Throws: java.lang.Exception if something went wrong

processDocType

protected void processDocType()
Processes a document type declaration.

Throws: java.lang.Exception if an error occurred reading or parsing the data

processElement

protected void processElement(String defaultNamespace, Properties namespaces)
Processes a regular element.

Parameters: defaultNamespace the default namespace URI (or null) namespaces list of defined namespaces

Throws: java.lang.Exception if something went wrong

processPI

protected void processPI()
Processes a "processing instruction".

Throws: java.lang.Exception if something went wrong

processSpecialTag

protected void processSpecialTag(boolean allowCDATA)
Processes a tag that starts with a bang (<!...>).

Parameters: allowCDATA true if CDATA sections are allowed at this point

Throws: java.lang.Exception if something went wrong

scanData

protected void scanData()
Scans the XML data for elements.

Throws: java.lang.Exception if something went wrong

scanSomeTag

protected void scanSomeTag(boolean allowCDATA, String defaultNamespace, Properties namespaces)
Scans an XML tag.

Parameters: allowCDATA true if CDATA sections are allowed at this point defaultNamespace the default namespace URI (or null) namespaces list of defined namespaces

Throws: java.lang.Exception if something went wrong

setBuilder

public void setBuilder(IXMLBuilder builder)
Sets the builder which creates the logical structure of the XML data.

Parameters: builder the non-null builder

setReader

public void setReader(IXMLReader reader)
Sets the reader from which the parser retrieves its data.

Parameters: reader the reader

setResolver

public void setResolver(IXMLEntityResolver resolver)
Sets the entity resolver.

Parameters: resolver the non-null resolver

setValidator

public void setValidator(IXMLValidator validator)
Sets the validator that validates the XML data.

Parameters: validator the non-null validator