xdoclet.util
public class XmlValidator extends org.xml.sax.helpers.DefaultHandler
Modifier and Type | Field and Description |
---|---|
protected java.lang.ClassLoader |
classLoader |
static java.lang.String |
DEFAULT_XML_READER_CLASSNAME
The crimson implementation is shipped with ant.
|
protected java.lang.String |
readerClassName |
protected org.xml.sax.XMLReader |
xmlReader
XMLReader used for validation
|
Constructor and Description |
---|
XmlValidator(java.lang.ClassLoader classLoader)
Describe what the XmlValidator constructor does
|
Modifier and Type | Method and Description |
---|---|
void |
error(org.xml.sax.SAXParseException e)
Called by parser if a error occurs
|
static XmlValidator |
getInstance()
Gets the Instance attribute of the XmlValidator class
|
void |
registerDTD(java.lang.String publicId,
java.net.URL dtdURL)
Registers a local DTD document by its public id.
|
void |
registerSchema(java.net.URL schemaURL)
Registers a local XSD document by its public id.
|
void |
reset()
Resets the Validator
|
org.xml.sax.InputSource |
resolveEntity(java.lang.String publicId,
java.lang.String systemId)
Called by parser when a DTD declaration is encountered in the parsed XML document
|
static void |
setInstance(XmlValidator instance)
Sets the Instance attribute of the XmlValidator class
|
void |
validate(java.io.File xmlFile)
Validates an XML file for conformance to a declared DTD or XMLSchema.
|
void |
warning(org.xml.sax.SAXParseException e)
Called by parser if a warning occurs
|
public static final java.lang.String DEFAULT_XML_READER_CLASSNAME
protected java.lang.ClassLoader classLoader
protected org.xml.sax.XMLReader xmlReader
protected java.lang.String readerClassName
public XmlValidator(java.lang.ClassLoader classLoader)
classLoader
- Describe what the parameter doespublic static XmlValidator getInstance()
public static void setInstance(XmlValidator instance)
instance
- The new Instance valuepublic void registerDTD(java.lang.String publicId, java.net.URL dtdURL)
publicId
- the publicId of the DTDdtdURL
- the URL of the local DTD, which must be loadable by the class passed in the constructor. This
URL typically points inside a local jar filepublic void registerSchema(java.net.URL schemaURL)
schemaURL
- public org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
resolveEntity
in interface org.xml.sax.EntityResolver
resolveEntity
in class org.xml.sax.helpers.DefaultHandler
publicId
- the public id of the DTDsystemId
- the system id of the DTDregisterDTD(java.lang.String, java.net.URL)
method. If not, null will be returned, and the parser will atempt to load the DTD
from the systemId value, Usually an Internet http URL.public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXParseException
error
in interface org.xml.sax.ErrorHandler
error
in class org.xml.sax.helpers.DefaultHandler
e
- an exception describing the errororg.xml.sax.SAXParseException
- every time this method is called by the parserpublic void warning(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXParseException
warning
in interface org.xml.sax.ErrorHandler
warning
in class org.xml.sax.helpers.DefaultHandler
e
- an exception describing the warningorg.xml.sax.SAXParseException
- every time this method is called by the parserpublic void validate(java.io.File xmlFile) throws XDocletException
xmlFile
- Description of ParameterXDocletException
- Description of Exceptionpublic void reset()