org.apache.xerces.impl.validation.validators
Class XMLDTDValidator

java.lang.Object
  |
  +--org.apache.xerces.impl.XMLValidator
        |
        +--org.apache.xerces.impl.validation.validators.XMLDTDValidator

public class XMLDTDValidator
extends XMLValidator

Version:
$Id: XMLDTDValidator.java,v 1.1.2.12 2001/07/26 08:03:37 andyc Exp $
Author:
Eric Ye, IBM

Fields inherited from class org.apache.xerces.impl.XMLValidator
DATATYPE_VALIDATOR_FACTORY, DYNAMIC_VALIDATION, ERROR_REPORTER, fCurrentGrammar, fCurrentGrammarIsDTD, fCurrentGrammarIsSchema, fDatatypeValidatorFactory, fDocumentHandler, fDTDContentModelHandler, fDTDGrammar, fDTDHandler, fDynamicValidation, fErrorReporter, fGrammarPool, fInDTD, fInDTDIgnore, fNamespaceBinder, fNamespaces, fSymbolTable, fValidation, GRAMMAR_POOL, NAMESPACES, RECOGNIZED_FEATURES, RECOGNIZED_PROPERTIES, SYMBOL_TABLE, VALIDATION
 
Constructor Summary
XMLDTDValidator()
           
 
Method Summary
 void any()
          Any.
 void attributeDecl(java.lang.String elementName, java.lang.String attributeName, java.lang.String type, java.lang.String[] enumeration, java.lang.String defaultType, org.apache.xerces.xni.XMLString defaultValue)
          An attribute declaration.
 void characters(org.apache.xerces.xni.XMLString text)
          Character content.
 void comment(org.apache.xerces.xni.XMLString text)
          A comment.
 void doctypeDecl(java.lang.String rootElement, java.lang.String publicId, java.lang.String systemId)
          Notifies of the presence of the DOCTYPE line in the document.
 void element(java.lang.String elementName)
          A referenced element.
 void elementDecl(java.lang.String name, java.lang.String contentModel)
          An element declaration.
 void empty()
          Empty.
 void endAttlist()
          The end of an attribute list.
 void endCDATA()
          The end of a CDATA section.
 void endConditional()
          The end of a conditional section.
 void endContentModel()
          The end of a content model.
 void endDocument()
          The end of the document.
 void endDTD()
          The end of the DTD.
 void endElement(org.apache.xerces.xni.QName element)
          The end of an element.
 void endEntity(java.lang.String name)
          This method notifies the end of an entity.
 void endGroup()
          The end of a group.
 void endPrefixMapping(java.lang.String prefix)
          The end of a namespace prefix mapping.
 void externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String baseSystemId)
          An external entity declaration.
 void ignorableWhitespace(org.apache.xerces.xni.XMLString text)
          Ignorable whitespace.
 void internalEntityDecl(java.lang.String name, org.apache.xerces.xni.XMLString text)
          An internal entity declaration.
 void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          A notation declaration
 void occurrence(short occurrence)
          The occurrence count for a child.
 void pcdata()
          #PCDATA.
 void processingInstruction(java.lang.String target, org.apache.xerces.xni.XMLString data)
          A processing instruction.
 void reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
          Resets the component.
 void separator(short separator)
          The separator between choices or sequences.
 void startAttlist(java.lang.String elementName)
          The start of an attribute list.
 void startCDATA()
          The start of a CDATA section.
 void startConditional(short type)
          The start of a conditional section.
 void startContentModel(java.lang.String elementName)
          The start of a content model.
 void startDocument(org.apache.xerces.xni.XMLLocator locator, java.lang.String encoding)
          The start of the document.
 void startDTD(org.apache.xerces.xni.XMLLocator locator)
          The start of the DTD.
 void startElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes)
          The start of an element.
 void startEntity(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String baseSystemId, java.lang.String encoding)
          This method notifies of the start of an entity.
 void startGroup()
          The start of a group.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          The start of a namespace prefix mapping.
 void textDecl(java.lang.String version, java.lang.String encoding)
          Notifies of the presence of a TextDecl line in an entity.
 void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notation)
          An unparsed entity declaration.
 void xmlDecl(java.lang.String version, java.lang.String encoding, java.lang.String standalone)
          Notifies of the presence of an XMLDecl line in the document.
 
Methods inherited from class org.apache.xerces.impl.XMLValidator
createDTDGrammar, emptyElement, getRecognizedFeatures, getRecognizedProperties, handleEndElement, handleStartElement, setDocumentHandler, setDTDContentModelHandler, setDTDHandler, setFeature, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLDTDValidator

public XMLDTDValidator()
Method Detail

reset

public void reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
           throws org.apache.xerces.xni.parser.XMLConfigurationException
Description copied from interface: org.apache.xerces.xni.parser.XMLComponent
Resets the component. The component can query the component manager about any features and properties that affect the operation of the component.
Overrides:
reset in class XMLValidator
Tags copied from interface: org.apache.xerces.xni.parser.XMLComponent
Parameters:
componentManager - The component manager.
Throws:
XNIException - Thrown by component on initialization error.

startDocument

public void startDocument(org.apache.xerces.xni.XMLLocator locator,
                          java.lang.String encoding)
                   throws org.apache.xerces.xni.XNIException
The start of the document.
Overrides:
startDocument in class XMLValidator
Parameters:
systemId - The system identifier of the entity if the entity is external, null otherwise.
encoding - The auto-detected IANA encoding name of the entity stream. This value will be null in those situations where the entity encoding is not auto-detected (e.g. internal entities or a document entity that is parsed from a java.io.Reader).
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

xmlDecl

public void xmlDecl(java.lang.String version,
                    java.lang.String encoding,
                    java.lang.String standalone)
             throws org.apache.xerces.xni.XNIException
Notifies of the presence of an XMLDecl line in the document. If present, this method will be called immediately following the startDocument call.
Overrides:
xmlDecl in class XMLValidator
Parameters:
version - The XML version.
encoding - The IANA encoding name of the document, or null if not specified.
standalone - The standalone value, or null if not specified.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

doctypeDecl

public void doctypeDecl(java.lang.String rootElement,
                        java.lang.String publicId,
                        java.lang.String systemId)
                 throws org.apache.xerces.xni.XNIException
Notifies of the presence of the DOCTYPE line in the document.
Overrides:
doctypeDecl in class XMLValidator
Parameters:
rootElement - The name of the root element.
publicId - The public identifier if an external DTD or null if the external DTD is specified using SYSTEM.
systemId - The system identifier if an external DTD, null otherwise.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.apache.xerces.xni.XNIException
The start of a namespace prefix mapping. This method will only be called when namespace processing is enabled.
Overrides:
startPrefixMapping in class XMLValidator
Parameters:
prefix - The namespace prefix.
uri - The URI bound to the prefix.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

startElement

public void startElement(org.apache.xerces.xni.QName element,
                         org.apache.xerces.xni.XMLAttributes attributes)
                  throws org.apache.xerces.xni.XNIException
The start of an element. If the document specifies the start element by using an empty tag, then the startElement method will immediately be followed by the endElement method, with no intervening methods.
Overrides:
startElement in class XMLValidator
Parameters:
element - The name of the element.
attributes - The element attributes.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

characters

public void characters(org.apache.xerces.xni.XMLString text)
                throws org.apache.xerces.xni.XNIException
Character content.
Overrides:
characters in class XMLValidator
Parameters:
text - The content.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

ignorableWhitespace

public void ignorableWhitespace(org.apache.xerces.xni.XMLString text)
                         throws org.apache.xerces.xni.XNIException
Ignorable whitespace. For this method to be called, the document source must have some way of determining that the text containing only whitespace characters should be considered ignorable. For example, the validator can determine if a length of whitespace characters in the document are ignorable based on the element content model.
Overrides:
ignorableWhitespace in class XMLValidator
Parameters:
text - The ignorable whitespace.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

endElement

public void endElement(org.apache.xerces.xni.QName element)
                throws org.apache.xerces.xni.XNIException
The end of an element.
Overrides:
endElement in class XMLValidator
Parameters:
element - The name of the element.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.apache.xerces.xni.XNIException
The end of a namespace prefix mapping. This method will only be called when namespace processing is enabled.
Overrides:
endPrefixMapping in class XMLValidator
Parameters:
prefix - The namespace prefix.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

startCDATA

public void startCDATA()
                throws org.apache.xerces.xni.XNIException
The start of a CDATA section.
Overrides:
startCDATA in class XMLValidator
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

endCDATA

public void endCDATA()
              throws org.apache.xerces.xni.XNIException
The end of a CDATA section.
Overrides:
endCDATA in class XMLValidator
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

endDocument

public void endDocument()
                 throws org.apache.xerces.xni.XNIException
The end of the document.
Overrides:
endDocument in class XMLValidator
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

startEntity

public void startEntity(java.lang.String name,
                        java.lang.String publicId,
                        java.lang.String systemId,
                        java.lang.String baseSystemId,
                        java.lang.String encoding)
                 throws org.apache.xerces.xni.XNIException
This method notifies of the start of an entity. The document entity has the pseudo-name of "[xml]"; The DTD has the pseudo-name of "[dtd]; parameter entity names start with '%'; and general entity names are just the entity name.

Note: Since the document is an entity, the handler will be notified of the start of the document entity by calling the startEntity method with the entity name "[xml]" before calling the startDocument method. When exposing entity boundaries through the SAX API, the document entity is never reported, however.

Note: Since the DTD is an entity, the handler will be notified of the start of the DTD entity by calling the startEntity method with the entity name "[dtd]" before calling the startDTD method.

Note: This method is not called for entity references appearing as part of attribute values.

Overrides:
startEntity in class XMLValidator
Parameters:
name - The name of the entity.
publicId - The public identifier of the entity if the entity is external, null otherwise.
systemId - The system identifier of the entity if the entity is external, null otherwise.
baseSystemId - The base system identifier of the entity if the entity is external, null otherwise.
encoding - The auto-detected IANA encoding name of the entity stream. This value will be null in those situations where the entity encoding is not auto-detected (e.g. internal parameter entities).
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

textDecl

public void textDecl(java.lang.String version,
                     java.lang.String encoding)
              throws org.apache.xerces.xni.XNIException
Notifies of the presence of a TextDecl line in an entity. If present, this method will be called immediately following the startEntity call.

Note: This method will never be called for the document entity; it is only called for external general entities referenced in document content.

Note: This method is not called for entity references appearing as part of attribute values.

Overrides:
textDecl in class XMLValidator
Parameters:
version - The XML version, or null if not specified.
encoding - The IANA encoding name of the entity.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

comment

public void comment(org.apache.xerces.xni.XMLString text)
             throws org.apache.xerces.xni.XNIException
A comment.
Overrides:
comment in class XMLValidator
Parameters:
text - The text in the comment.
Throws:
org.apache.xerces.xni.XNIException - Thrown by application to signal an error.

processingInstruction

public void processingInstruction(java.lang.String target,
                                  org.apache.xerces.xni.XMLString data)
                           throws org.apache.xerces.xni.XNIException
A processing instruction. Processing instructions consist of a target name and, optionally, text data. The data is only meaningful to the application.

Typically, a processing instruction's data will contain a series of pseudo-attributes. These pseudo-attributes follow the form of element attributes but are not parsed or presented to the application as anything other than text. The application is responsible for parsing the data.

Overrides:
processingInstruction in class XMLValidator
Parameters:
target - The target.
data - The data or null if none specified.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

endEntity

public void endEntity(java.lang.String name)
               throws org.apache.xerces.xni.XNIException
This method notifies the end of an entity. The document entity has the pseudo-name of "[xml]"; the DTD has the pseudo-name of "[dtd]; parameter entity names start with '%'; and general entity names are just the entity name.

Note: Since the document is an entity, the handler will be notified of the end of the document entity by calling the endEntity method with the entity name "[xml]" after calling the endDocument method. When exposing entity boundaries through the SAX API, the document entity is never reported, however.

Note: Since the DTD is an entity, the handler will be notified of the end of the DTD entity by calling the endEntity method with the entity name "[dtd]" after calling the endDTD method.

Note: This method is not called for entity references appearing as part of attribute values.

Overrides:
endEntity in class XMLValidator
Parameters:
name - The name of the entity.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

startDTD

public void startDTD(org.apache.xerces.xni.XMLLocator locator)
              throws org.apache.xerces.xni.XNIException
The start of the DTD.
Overrides:
startDTD in class XMLValidator
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

elementDecl

public void elementDecl(java.lang.String name,
                        java.lang.String contentModel)
                 throws org.apache.xerces.xni.XNIException
An element declaration.
Overrides:
elementDecl in class XMLValidator
Parameters:
name - The name of the element.
contentModel - The element content model.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

startAttlist

public void startAttlist(java.lang.String elementName)
                  throws org.apache.xerces.xni.XNIException
The start of an attribute list.
Overrides:
startAttlist in class XMLValidator
Parameters:
elementName - The name of the element that this attribute list is associated with.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

attributeDecl

public void attributeDecl(java.lang.String elementName,
                          java.lang.String attributeName,
                          java.lang.String type,
                          java.lang.String[] enumeration,
                          java.lang.String defaultType,
                          org.apache.xerces.xni.XMLString defaultValue)
                   throws org.apache.xerces.xni.XNIException
An attribute declaration.
Overrides:
attributeDecl in class XMLValidator
Parameters:
elementName - The name of the element that this attribute is associated with.
attributeName - The name of the attribute.
type - The attribute type. This value will be one of the following: "CDATA", "ENTITY", "ENTITIES", "ENUMERATION", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", or "NOTATION".
enumeration - If the type has the value "ENUMERATION", this array holds the allowed attribute values; otherwise, this array is null.
defaultType - The attribute default type. This value will be one of the following: "#FIXED", "#IMPLIED", "#REQUIRED", or null.
defaultValue - The attribute default value, or null if no default value is specified.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

endAttlist

public void endAttlist()
                throws org.apache.xerces.xni.XNIException
The end of an attribute list.
Overrides:
endAttlist in class XMLValidator
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

internalEntityDecl

public void internalEntityDecl(java.lang.String name,
                               org.apache.xerces.xni.XMLString text)
                        throws org.apache.xerces.xni.XNIException
An internal entity declaration.
Overrides:
internalEntityDecl in class XMLValidator
Parameters:
name - The name of the entity. Parameter entity names start with '%', whereas the name of a general entity is just the entity name.
text - The value of the entity.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

externalEntityDecl

public void externalEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId,
                               java.lang.String baseSystemId)
                        throws org.apache.xerces.xni.XNIException
An external entity declaration.
Overrides:
externalEntityDecl in class XMLValidator
Parameters:
name - The name of the entity. Parameter entity names start with '%', whereas the name of a general entity is just the entity name.
publicId - The public identifier of the entity or null if the the entity was specified with SYSTEM.
systemId - The system identifier of the entity.
baseSystemId - The base system identifier of the entity if the entity is external, null otherwise.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

unparsedEntityDecl

public void unparsedEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId,
                               java.lang.String notation)
                        throws org.apache.xerces.xni.XNIException
An unparsed entity declaration.
Overrides:
unparsedEntityDecl in class XMLValidator
Parameters:
name - The name of the entity.
publicId - The public identifier of the entity, or null if not specified.
systemId - The system identifier of the entity, or null if not specified.
notation - The name of the notation.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

notationDecl

public void notationDecl(java.lang.String name,
                         java.lang.String publicId,
                         java.lang.String systemId)
                  throws org.apache.xerces.xni.XNIException
A notation declaration
Overrides:
notationDecl in class XMLValidator
Parameters:
name - The name of the notation.
publicId - The public identifier of the notation, or null if not specified.
systemId - The system identifier of the notation, or null if not specified.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

startConditional

public void startConditional(short type)
                      throws org.apache.xerces.xni.XNIException
The start of a conditional section.
Overrides:
startConditional in class XMLValidator
Parameters:
type - The type of the conditional section. This value will either be CONDITIONAL_INCLUDE or CONDITIONAL_IGNORE.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
See Also:
CONDITIONAL_INCLUDE, CONDITIONAL_IGNORE

endConditional

public void endConditional()
                    throws org.apache.xerces.xni.XNIException
The end of a conditional section.
Overrides:
endConditional in class XMLValidator
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

endDTD

public void endDTD()
            throws org.apache.xerces.xni.XNIException
The end of the DTD.
Overrides:
endDTD in class XMLValidator
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

startContentModel

public void startContentModel(java.lang.String elementName)
                       throws org.apache.xerces.xni.XNIException
The start of a content model. Depending on the type of the content model, specific methods may be called between the call to the startContentModel method and the call to the endContentModel method.
Overrides:
startContentModel in class XMLValidator
Parameters:
elementName - The name of the element.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

any

public void any()
         throws org.apache.xerces.xni.XNIException
Any.
Overrides:
any in class XMLValidator
Tags copied from interface: org.apache.xerces.xni.XMLDTDContentModelHandler
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
See Also:
XMLDTDContentModelHandler.empty(), XMLDTDContentModelHandler.startGroup()

empty

public void empty()
           throws org.apache.xerces.xni.XNIException
Empty.
Overrides:
empty in class XMLValidator
Tags copied from interface: org.apache.xerces.xni.XMLDTDContentModelHandler
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
See Also:
XMLDTDContentModelHandler.any(), XMLDTDContentModelHandler.startGroup()

startGroup

public void startGroup()
                throws org.apache.xerces.xni.XNIException
The start of a group.

Note: Children groups can be nested and have associated occurrence counts.

Overrides:
startGroup in class XMLValidator
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

pcdata

public void pcdata()
            throws org.apache.xerces.xni.XNIException
#PCDATA.
Overrides:
pcdata in class XMLValidator
Tags copied from interface: org.apache.xerces.xni.XMLDTDContentModelHandler
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
See Also:
XMLDTDContentModelHandler.startGroup()

element

public void element(java.lang.String elementName)
             throws org.apache.xerces.xni.XNIException
A referenced element.
Overrides:
element in class XMLValidator
Parameters:
elementName - The name of the referenced element.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

separator

public void separator(short separator)
               throws org.apache.xerces.xni.XNIException
The separator between choices or sequences.
Overrides:
separator in class XMLValidator
Parameters:
separator - The type of separator.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
See Also:
SEPARATOR_CHOICE, SEPARATOR_SEQUENCE

occurrence

public void occurrence(short occurrence)
                throws org.apache.xerces.xni.XNIException
The occurrence count for a child.
Overrides:
occurrence in class XMLValidator
Parameters:
occurrence - The occurrence count.
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
See Also:
OCCURS_ZERO_OR_ONE, OCCURS_ZERO_OR_MORE, OCCURS_ONE_OR_MORE

endGroup

public void endGroup()
              throws org.apache.xerces.xni.XNIException
The end of a group.
Overrides:
endGroup in class XMLValidator
Tags copied from interface: org.apache.xerces.xni.XMLDTDContentModelHandler
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

endContentModel

public void endContentModel()
                     throws org.apache.xerces.xni.XNIException
The end of a content model.
Overrides:
endContentModel in class XMLValidator
Throws:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.


Copyright © 1999-2001 Apache XML Project. All Rights Reserved.