public class ValidatorPlugin extends java.lang.Object implements IXMLValidator
Constructor and Description |
---|
ValidatorPlugin()
Initializes the plugin.
|
Modifier and Type | Method and Description |
---|---|
void |
attributeAdded(java.lang.String key,
java.lang.String value,
java.lang.String systemId,
int lineNr)
This method is called when the attributes of an XML element have been
processed.
|
void |
elementAttributesProcessed(java.lang.String name,
java.util.Properties extraAttributes,
java.lang.String systemId,
int lineNr)
Indicates that an attribute has been added to the current element.
|
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.
|
IXMLValidator |
getDelegate()
Returns the delegate.
|
IXMLEntityResolver |
getParameterEntityResolver()
Returns the parameter entity resolver.
|
void |
invalidAttributeValue(java.lang.String systemID,
int lineNr,
java.lang.String elementName,
java.lang.String attributeName,
java.lang.String attributeValue)
Throws an XMLValidationException to indicate that an attribute has an
invalid value.
|
void |
missingAttribute(java.lang.String systemID,
int lineNr,
java.lang.String elementName,
java.lang.String attributeName)
Throws an XMLValidationException to indicate that an attribute is
missing.
|
void |
missingElement(java.lang.String systemID,
int lineNr,
java.lang.String parentElementName,
java.lang.String missingElementName)
Throws an XMLValidationException to indicate that an element is missing.
|
void |
missingPCData(java.lang.String systemID,
int lineNr,
java.lang.String parentElementName)
Throws an XMLValidationException to indicate that a #PCDATA element was
missing.
|
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.
|
void |
setDelegate(IXMLValidator delegate)
Sets the delegate.
|
void |
setParameterEntityResolver(IXMLEntityResolver resolver)
Sets the parameter entity resolver.
|
void |
unexpectedAttribute(java.lang.String systemID,
int lineNr,
java.lang.String elementName,
java.lang.String attributeName)
Throws an XMLValidationException to indicate that an attribute is
unexpected.
|
void |
unexpectedElement(java.lang.String systemID,
int lineNr,
java.lang.String parentElementName,
java.lang.String unexpectedElementName)
Throws an XMLValidationException to indicate that an element is
unexpected.
|
void |
unexpectedPCData(java.lang.String systemID,
int lineNr,
java.lang.String parentElementName)
Throws an XMLValidationException to indicate that a #PCDATA element was
unexpected.
|
void |
validationError(java.lang.String systemID,
int lineNr,
java.lang.String message,
java.lang.String elementName,
java.lang.String attributeName,
java.lang.String attributeValue)
Throws an XMLValidationException.
|
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public IXMLValidator getDelegate()
public void setDelegate(IXMLValidator delegate)
delegate
- the delegatepublic void setParameterEntityResolver(IXMLEntityResolver resolver)
setParameterEntityResolver
in interface IXMLValidator
resolver
- the entity resolver.public IXMLEntityResolver getParameterEntityResolver()
getParameterEntityResolver
in interface IXMLValidator
public void parseDTD(java.lang.String publicID, IXMLReader reader, IXMLEntityResolver entityResolver, boolean external) throws java.lang.Exception
parseDTD
in interface IXMLValidator
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.java.lang.Exception
- if something went wrong.public void elementStarted(java.lang.String name, java.lang.String systemId, int lineNr) throws java.lang.Exception
elementStarted
in interface IXMLValidator
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.java.lang.Exception
- if the element could not be validated.public void elementEnded(java.lang.String name, java.lang.String systemId, int lineNr) throws java.lang.Exception
elementEnded
in interface IXMLValidator
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.java.lang.Exception
- if the element could not be validated.public void elementAttributesProcessed(java.lang.String name, java.util.Properties extraAttributes, java.lang.String systemId, int lineNr) throws java.lang.Exception
elementAttributesProcessed
in interface IXMLValidator
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.java.lang.Exception
- if the attribute could not be validated.public void attributeAdded(java.lang.String key, java.lang.String value, java.lang.String systemId, int lineNr) throws java.lang.Exception
attributeAdded
in interface IXMLValidator
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.java.lang.Exception
- if the element could not be validated.public void PCDataAdded(java.lang.String systemId, int lineNr) throws java.lang.Exception
PCDataAdded
in interface IXMLValidator
systemId
- the system ID of the XML data of the element.lineNr
- the line number in the XML data of the element.java.lang.Exception
- if the element could not be validated.public void missingElement(java.lang.String systemID, int lineNr, java.lang.String parentElementName, java.lang.String missingElementName) throws XMLValidationException
systemID
- the system ID of the XML data of the elementlineNr
- the line number in the XML data of the elementparentElementName
- the name of the parent elementmissingElementName
- the name of the missing elementXMLValidationException
- of course :-)public void unexpectedElement(java.lang.String systemID, int lineNr, java.lang.String parentElementName, java.lang.String unexpectedElementName) throws XMLValidationException
systemID
- the system ID of the XML data of the
elementlineNr
- the line number in the XML data of the
elementparentElementName
- the name of the parent elementunexpectedElementName
- the name of the missing elementXMLValidationException
- of course :-)public void missingAttribute(java.lang.String systemID, int lineNr, java.lang.String elementName, java.lang.String attributeName) throws XMLValidationException
systemID
- the system ID of the XML data of the elementlineNr
- the line number in the XML data of the elementelementName
- the name of the elementattributeName
- the name of the missing attributeXMLValidationException
- of course :-)public void unexpectedAttribute(java.lang.String systemID, int lineNr, java.lang.String elementName, java.lang.String attributeName) throws XMLValidationException
systemID
- the system ID of the XML data of the elementlineNr
- the line number in the XML data of the elementelementName
- the name of the elementattributeName
- the name of the unexpected attributeXMLValidationException
- of course :-)public void invalidAttributeValue(java.lang.String systemID, int lineNr, java.lang.String elementName, java.lang.String attributeName, java.lang.String attributeValue) throws XMLValidationException
systemID
- the system ID of the XML data of the elementlineNr
- the line number in the XML data of the elementelementName
- the name of the elementattributeName
- the name of the attributeattributeValue
- the value of the attributeXMLValidationException
- of course :-)public void missingPCData(java.lang.String systemID, int lineNr, java.lang.String parentElementName) throws XMLValidationException
systemID
- the system ID of the XML data of the elementlineNr
- the line number in the XML data of the elementparentElementName
- the name of the parent elementXMLValidationException
- of course :-)public void unexpectedPCData(java.lang.String systemID, int lineNr, java.lang.String parentElementName) throws XMLValidationException
systemID
- the system ID of the XML data of the elementlineNr
- the line number in the XML data of the elementparentElementName
- the name of the parent elementXMLValidationException
- of course :-)public void validationError(java.lang.String systemID, int lineNr, java.lang.String message, java.lang.String elementName, java.lang.String attributeName, java.lang.String attributeValue) throws XMLValidationException
systemID
- the system ID of the XML data of the elementlineNr
- the line number in the XML data of the elementmessage
- the error messageelementName
- the name of the element (may be null)attributeName
- the name of the attribute (may be null)attributeValue
- the value of the attribute (may be null)XMLValidationException
- of course :-)