JHotDraw 7.4.1

net.n3.nanoxml
Class StdXMLParser

java.lang.Object
  extended by net.n3.nanoxml.StdXMLParser
All Implemented Interfaces:
IXMLParser

public class StdXMLParser
extends java.lang.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  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(java.util.Vector attrNames, java.util.Vector attrValues, java.util.Vector attrTypes)
          Processes an attribute of an element.
protected  void processCDATA()
          Processes a CDATA section.
protected  void processDocType()
          Processes a document type declaration.
protected  void processElement(java.lang.String defaultNamespace, java.util.Properties namespaces)
          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, java.lang.String defaultNamespace, java.util.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.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StdXMLParser

public StdXMLParser()
Creates a new parser.

Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Cleans up the object when it's destroyed.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

setBuilder

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

Specified by:
setBuilder in interface IXMLParser
Parameters:
builder - the non-null builder

getBuilder

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

Specified by:
getBuilder in interface IXMLParser
Returns:
the builder

setValidator

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

Specified by:
setValidator in interface IXMLParser
Parameters:
validator - the non-null validator

getValidator

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

Specified by:
getValidator in interface IXMLParser
Returns:
the validator

setResolver

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

Specified by:
setResolver in interface IXMLParser
Parameters:
resolver - the non-null resolver

getResolver

public IXMLEntityResolver getResolver()
Returns the entity resolver.

Specified by:
getResolver in interface IXMLParser
Returns:
the non-null resolver

setReader

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

Specified by:
setReader in interface IXMLParser
Parameters:
reader - the reader

getReader

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

Specified by:
getReader in interface IXMLParser
Returns:
the reader

parse

public java.lang.Object parse()
                       throws XMLException
Parses the data and lets the builder create the logical data structure.

Specified by:
parse in interface IXMLParser
Returns:
the logical structure built by the builder
Throws:
XMLException - if an error occurred reading or parsing the data
See Also:
IXMLBuilder.getResult()

scanData

protected void scanData()
                 throws java.lang.Exception
Scans the XML data for elements.

Throws:
java.lang.Exception - if something went wrong

scanSomeTag

protected void scanSomeTag(boolean allowCDATA,
                           java.lang.String defaultNamespace,
                           java.util.Properties namespaces)
                    throws java.lang.Exception
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

processPI

protected void processPI()
                  throws java.lang.Exception
Processes a "processing instruction".

Throws:
java.lang.Exception - if something went wrong

processSpecialTag

protected void processSpecialTag(boolean allowCDATA)
                          throws java.lang.Exception
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

processCDATA

protected void processCDATA()
                     throws java.lang.Exception
Processes a CDATA section.

Throws:
java.lang.Exception - if something went wrong

processDocType

protected void processDocType()
                       throws java.lang.Exception
Processes a document type declaration.

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

processElement

protected void processElement(java.lang.String defaultNamespace,
                              java.util.Properties namespaces)
                       throws java.lang.Exception
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

processAttribute

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

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.