public class ValidatorPlugin extends Object implements IXMLValidator
Constructor and Description |
---|
ValidatorPlugin()
Initializes the plugin.
|
Modifier and Type | Method and Description |
---|---|
void |
attributeAdded(String key,
String value,
String systemId,
int lineNr)
This method is called when the attributes of an XML element have been
processed.
|
void |
elementAttributesProcessed(String name,
Properties extraAttributes,
String systemId,
int lineNr)
Indicates that an attribute has been added to the current element.
|
void |
elementEnded(String name,
String systemId,
int lineNr)
Indicates that the current element has ended.
|
void |
elementStarted(String name,
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(String systemID,
int lineNr,
String elementName,
String attributeName,
String attributeValue)
Throws an XMLValidationException to indicate that an attribute has an
invalid value.
|
void |
missingAttribute(String systemID,
int lineNr,
String elementName,
String attributeName)
Throws an XMLValidationException to indicate that an attribute is
missing.
|
void |
missingElement(String systemID,
int lineNr,
String parentElementName,
String missingElementName)
Throws an XMLValidationException to indicate that an element is missing.
|
void |
missingPCData(String systemID,
int lineNr,
String parentElementName)
Throws an XMLValidationException to indicate that a #PCDATA element was
missing.
|
void |
parseDTD(String publicID,
IXMLReader reader,
IXMLEntityResolver entityResolver,
boolean external)
Parses the DTD.
|
void |
PCDataAdded(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(String systemID,
int lineNr,
String elementName,
String attributeName)
Throws an XMLValidationException to indicate that an attribute is
unexpected.
|
void |
unexpectedElement(String systemID,
int lineNr,
String parentElementName,
String unexpectedElementName)
Throws an XMLValidationException to indicate that an element is
unexpected.
|
void |
unexpectedPCData(String systemID,
int lineNr,
String parentElementName)
Throws an XMLValidationException to indicate that a #PCDATA element was
unexpected.
|
void |
validationError(String systemID,
int lineNr,
String message,
String elementName,
String attributeName,
String attributeValue)
Throws an XMLValidationException.
|
protected void finalize() throws 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(String publicID, IXMLReader reader, IXMLEntityResolver entityResolver, boolean external) throws 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.Exception
- if something went wrong.public void elementStarted(String name, String systemId, int lineNr) throws 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.Exception
- if the element could not be validated.public void elementEnded(String name, String systemId, int lineNr) throws 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.Exception
- if the element could not be validated.public void elementAttributesProcessed(String name, Properties extraAttributes, String systemId, int lineNr) throws Exception
elementAttributesProcessed
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.Exception
- if the attribute could not be validated.public void attributeAdded(String key, String value, String systemId, int lineNr) throws Exception
attributeAdded
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.Exception
- if the element could not be validated.public void PCDataAdded(String systemId, int lineNr) throws 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.Exception
- if the element could not be validated.public void missingElement(String systemID, int lineNr, String parentElementName, 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(String systemID, int lineNr, String parentElementName, 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(String systemID, int lineNr, String elementName, 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(String systemID, int lineNr, String elementName, 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(String systemID, int lineNr, String elementName, String attributeName, 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(String systemID, int lineNr, 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(String systemID, int lineNr, 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(String systemID, int lineNr, String message, String elementName, String attributeName, 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 :-)