Package net.n3.nanoxml
Class NonValidator
java.lang.Object
net.n3.nanoxml.NonValidator
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionprotected HashtableContains the default values for attributes for the different element types.protected StackThe stack of elements to be processed.protected IXMLEntityResolverThe parameter entity resolver. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidattributeAdded(String key, String value, String systemId, int lineNr) Indicates that an attribute has been added to the current element.voidelementAttributesProcessed(String name, Properties extraAttributes, String systemId, int lineNr) This method is called when the attributes of an XML element have been processed.voidelementEnded(String name, String systemId, int lineNr) Indicates that the current element has ended.voidelementStarted(String name, String systemId, int lineNr) Indicates that an element has been started.protected voidfinalize()Cleans up the object when it's destroyed.Returns the parameter entity resolver.voidparseDTD(String publicID, IXMLReader reader, IXMLEntityResolver entityResolver, boolean external) Parses the DTD.voidPCDataAdded(String systemId, int lineNr) Indicates that a new #PCDATA element has been encountered.protected voidprocessAttList(IXMLReader reader, IXMLEntityResolver entityResolver) Processes an ATTLIST element.protected voidprocessConditionalSection(IXMLReader reader, IXMLEntityResolver entityResolver) Processes a conditional section.protected voidprocessElement(IXMLReader reader, IXMLEntityResolver entityResolver) Processes an element in the DTD.protected voidprocessEntity(IXMLReader reader, IXMLEntityResolver entityResolver) Processes an ENTITY element.protected voidprocessIgnoreSection(IXMLReader reader, IXMLEntityResolver entityResolver) Processes an ignore section.voidsetParameterEntityResolver(IXMLEntityResolver resolver) Sets the parameter entity resolver.
-
Field Details
-
parameterEntityResolver
The parameter entity resolver. -
attributeDefaultValues
Contains the default values for attributes for the different element types. -
currentElements
The stack of elements to be processed.
-
-
Constructor Details
-
NonValidator
public NonValidator()Creates the "validator".
-
-
Method Details
-
finalize
Cleans up the object when it's destroyed. -
setParameterEntityResolver
Sets the parameter entity resolver.- Specified by:
setParameterEntityResolverin interfaceIXMLValidator- Parameters:
resolver- the entity resolver.
-
getParameterEntityResolver
Returns the parameter entity resolver.- Specified by:
getParameterEntityResolverin interfaceIXMLValidator- Returns:
- the entity resolver.
-
parseDTD
public void parseDTD(String publicID, IXMLReader reader, IXMLEntityResolver entityResolver, boolean external) throws Exception Parses the DTD. The validator object is responsible for reading the full DTD.- Specified by:
parseDTDin interfaceIXMLValidator- 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:
Exception- If something went wrong.
-
processElement
protected void processElement(IXMLReader reader, IXMLEntityResolver entityResolver) throws Exception Processes an element in the DTD.- Parameters:
reader- the reader to read data from.entityResolver- the entity resolver.- Throws:
Exception- If something went wrong.
-
processConditionalSection
protected void processConditionalSection(IXMLReader reader, IXMLEntityResolver entityResolver) throws Exception Processes a conditional section.- Parameters:
reader- the reader to read data from.entityResolver- the entity resolver.- Throws:
Exception- If something went wrong.
-
processIgnoreSection
protected void processIgnoreSection(IXMLReader reader, IXMLEntityResolver entityResolver) throws Exception Processes an ignore section.- Parameters:
reader- the reader to read data from.entityResolver- the entity resolver.- Throws:
Exception- If something went wrong.
-
processAttList
protected void processAttList(IXMLReader reader, IXMLEntityResolver entityResolver) throws Exception Processes an ATTLIST element.- Parameters:
reader- the reader to read data from.entityResolver- the entity resolver.- Throws:
Exception- If something went wrong.
-
processEntity
Processes an ENTITY element.- Parameters:
reader- the reader to read data from.entityResolver- the entity resolver.- Throws:
Exception- If something went wrong.
-
elementStarted
Indicates that an element has been started.- Specified by:
elementStartedin interfaceIXMLValidator- 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
Indicates that the current element has ended.- Specified by:
elementEndedin interfaceIXMLValidator- 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(String name, Properties extraAttributes, 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:
elementAttributesProcessedin interfaceIXMLValidator- 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
Indicates that an attribute has been added to the current element.- Specified by:
attributeAddedin interfaceIXMLValidator- 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
Indicates that a new #PCDATA element has been encountered.- Specified by:
PCDataAddedin interfaceIXMLValidator- Parameters:
systemId- the system ID of the XML data of the element.lineNr- the line number in the XML data of the element.
-