JHotDraw 7.4.1

net.n3.nanoxml
Class NonValidator

java.lang.Object
  extended by net.n3.nanoxml.NonValidator
All Implemented Interfaces:
IXMLValidator

public class NonValidator
extends java.lang.Object
implements IXMLValidator

NonValidator is a concrete implementation of IXMLValidator which processes the DTD and handles entity definitions. It does not do any validation itself.

Version:
$Name: RELEASE_2_2_1 $, $Revision: 1.4 $
Author:
Marc De Scheemaecker

Field Summary
protected  java.util.Hashtable attributeDefaultValues
          Contains the default values for attributes for the different element types.
protected  java.util.Stack currentElements
          The stack of elements to be processed.
protected  IXMLEntityResolver parameterEntityResolver
          The parameter entity resolver.
 
Constructor Summary
NonValidator()
          Creates the "validator".
 
Method Summary
 void attributeAdded(java.lang.String key, java.lang.String value, java.lang.String systemId, int lineNr)
          Indicates that an attribute has been added to the current element.
 void elementAttributesProcessed(java.lang.String name, java.util.Properties extraAttributes, java.lang.String systemId, int lineNr)
          This method is called when the attributes of an XML element have been processed.
 void elementEnded(java.lang.String name, java.lang.String systemId, int lineNr)
          Indicates that the current element has ended.
 void elementStarted(java.lang.String name, java.lang.String systemId, int lineNr)
          Indicates that an element has been started.
protected  void finalize()
          Cleans up the object when it's destroyed.
 IXMLEntityResolver getParameterEntityResolver()
          Returns the parameter entity resolver.
 void parseDTD(java.lang.String publicID, IXMLReader reader, IXMLEntityResolver entityResolver, boolean external)
          Parses the DTD.
 void PCDataAdded(java.lang.String systemId, int lineNr)
          Indicates that a new #PCDATA element has been encountered.
protected  void processAttList(IXMLReader reader, IXMLEntityResolver entityResolver)
          Processes an ATTLIST element.
protected  void processConditionalSection(IXMLReader reader, IXMLEntityResolver entityResolver)
          Processes a conditional section.
protected  void processElement(IXMLReader reader, IXMLEntityResolver entityResolver)
          Processes an element in the DTD.
protected  void processEntity(IXMLReader reader, IXMLEntityResolver entityResolver)
          Processes an ENTITY element.
protected  void processIgnoreSection(IXMLReader reader, IXMLEntityResolver entityResolver)
          Processes an ignore section.
 void setParameterEntityResolver(IXMLEntityResolver resolver)
          Sets the parameter entity resolver.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parameterEntityResolver

protected IXMLEntityResolver parameterEntityResolver
The parameter entity resolver.


attributeDefaultValues

protected java.util.Hashtable attributeDefaultValues
Contains the default values for attributes for the different element types.


currentElements

protected java.util.Stack currentElements
The stack of elements to be processed.

Constructor Detail

NonValidator

public NonValidator()
Creates the "validator".

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

setParameterEntityResolver

public void setParameterEntityResolver(IXMLEntityResolver resolver)
Sets the parameter entity resolver.

Specified by:
setParameterEntityResolver in interface IXMLValidator
Parameters:
resolver - the entity resolver.

getParameterEntityResolver

public IXMLEntityResolver getParameterEntityResolver()
Returns the parameter entity resolver.

Specified by:
getParameterEntityResolver in interface IXMLValidator
Returns:
the entity resolver.

parseDTD

public void parseDTD(java.lang.String publicID,
                     IXMLReader reader,
                     IXMLEntityResolver entityResolver,
                     boolean external)
              throws java.lang.Exception
Parses the DTD. The validator object is responsible for reading the full DTD.

Specified by:
parseDTD in interface IXMLValidator
Parameters:
publicID - the public ID, which may be null.
reader - the reader to read the DTD from.
entityResolver - the entity resolver.
external - true if the DTD is external.
Throws:
java.lang.Exception - If something went wrong.

processElement

protected void processElement(IXMLReader reader,
                              IXMLEntityResolver entityResolver)
                       throws java.lang.Exception
Processes an element in the DTD.

Parameters:
reader - the reader to read data from.
entityResolver - the entity resolver.
Throws:
java.lang.Exception - If something went wrong.

processConditionalSection

protected void processConditionalSection(IXMLReader reader,
                                         IXMLEntityResolver entityResolver)
                                  throws java.lang.Exception
Processes a conditional section.

Parameters:
reader - the reader to read data from.
entityResolver - the entity resolver.
Throws:
java.lang.Exception - If something went wrong.

processIgnoreSection

protected void processIgnoreSection(IXMLReader reader,
                                    IXMLEntityResolver entityResolver)
                             throws java.lang.Exception
Processes an ignore section.

Parameters:
reader - the reader to read data from.
entityResolver - the entity resolver.
Throws:
java.lang.Exception - If something went wrong.

processAttList

protected void processAttList(IXMLReader reader,
                              IXMLEntityResolver entityResolver)
                       throws java.lang.Exception
Processes an ATTLIST element.

Parameters:
reader - the reader to read data from.
entityResolver - the entity resolver.
Throws:
java.lang.Exception - If something went wrong.

processEntity

protected void processEntity(IXMLReader reader,
                             IXMLEntityResolver entityResolver)
                      throws java.lang.Exception
Processes an ENTITY element.

Parameters:
reader - the reader to read data from.
entityResolver - the entity resolver.
Throws:
java.lang.Exception - If something went wrong.

elementStarted

public void elementStarted(java.lang.String name,
                           java.lang.String systemId,
                           int lineNr)
Indicates that an element has been started.

Specified by:
elementStarted in interface IXMLValidator
Parameters:
name - the name of the element.
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.

elementEnded

public void elementEnded(java.lang.String name,
                         java.lang.String systemId,
                         int lineNr)
Indicates that the current element has ended.

Specified by:
elementEnded in interface IXMLValidator
Parameters:
name - the name of the element.
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.

elementAttributesProcessed

public void elementAttributesProcessed(java.lang.String name,
                                       java.util.Properties extraAttributes,
                                       java.lang.String systemId,
                                       int lineNr)
This method is called when the attributes of an XML element have been processed. If there are attributes with a default value which have not been specified yet, they have to be put into extraAttributes.

Specified by:
elementAttributesProcessed in interface IXMLValidator
Parameters:
name - the name of the element.
extraAttributes - where to put extra attributes.
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.

attributeAdded

public void attributeAdded(java.lang.String key,
                           java.lang.String value,
                           java.lang.String systemId,
                           int lineNr)
Indicates that an attribute has been added to the current element.

Specified by:
attributeAdded in interface IXMLValidator
Parameters:
key - the name of the attribute.
value - the value of the attribute.
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.

PCDataAdded

public void PCDataAdded(java.lang.String systemId,
                        int lineNr)
Indicates that a new #PCDATA element has been encountered.

Specified by:
PCDataAdded in interface IXMLValidator
Parameters:
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.

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