Fields Summary |
---|
private static final String | CURRENT_ELEMENT_NODEProperty identifier: Current element node. |
private XMLSchemaValidatorComponentManager | fComponentManagerComponent manager. |
private ValidatorHandlerImpl | fSAXValidatorHelperSAX validator helper. |
private DOMValidatorHelper | fDOMValidatorHelperDOM validator helper. |
private StreamValidatorHelper | fStreamValidatorHelperStream validator helper. |
private boolean | fConfigurationChangedFlag for tracking whether features/properties changed since last reset. |
private boolean | fErrorHandlerChangedFlag for tracking whether the error handler changed since last reset. |
private boolean | fResourceResolverChangedFlag for tracking whether the resource resolver changed since last reset. |
Methods Summary |
---|
public org.apache.xerces.xs.AttributePSVI | getAttributePSVI(int index)
return (fSAXValidatorHelper != null) ? fSAXValidatorHelper.getAttributePSVI(index) : null;
|
public org.apache.xerces.xs.AttributePSVI | getAttributePSVIByName(java.lang.String uri, java.lang.String localname)
return (fSAXValidatorHelper != null) ? fSAXValidatorHelper.getAttributePSVIByName(uri, localname) : null;
|
public org.apache.xerces.xs.ElementPSVI | getElementPSVI()
return (fSAXValidatorHelper != null) ? fSAXValidatorHelper.getElementPSVI() : null;
|
public org.xml.sax.ErrorHandler | getErrorHandler()
return fComponentManager.getErrorHandler();
|
public boolean | getFeature(java.lang.String name)
if (name == null) {
throw new NullPointerException();
}
try {
return fComponentManager.getFeature(name);
}
catch (XMLConfigurationException e) {
final String identifier = e.getIdentifier();
final String key = e.getType() == XMLConfigurationException.NOT_RECOGNIZED ?
"feature-not-recognized" : "feature-not-supported";
throw new SAXNotRecognizedException(
SAXMessageFormatter.formatMessage(Locale.getDefault(),
key, new Object [] {identifier}));
}
|
public java.lang.Object | getProperty(java.lang.String name)
if (name == null) {
throw new NullPointerException();
}
if (CURRENT_ELEMENT_NODE.equals(name)) {
return (fDOMValidatorHelper != null) ?
fDOMValidatorHelper.getCurrentElement() : null;
}
try {
return fComponentManager.getProperty(name);
}
catch (XMLConfigurationException e) {
final String identifier = e.getIdentifier();
final String key = e.getType() == XMLConfigurationException.NOT_RECOGNIZED ?
"property-not-recognized" : "property-not-supported";
throw new SAXNotRecognizedException(
SAXMessageFormatter.formatMessage(Locale.getDefault(),
key, new Object [] {identifier}));
}
|
public org.w3c.dom.ls.LSResourceResolver | getResourceResolver()
return fComponentManager.getResourceResolver();
|
public void | reset()
// avoid resetting features and properties if the state the validator
// is currently in, is the same as it will be after reset.
if (fConfigurationChanged) {
fComponentManager.restoreInitialState();
setErrorHandler(null);
setResourceResolver(null);
fConfigurationChanged = false;
fErrorHandlerChanged = false;
fResourceResolverChanged = false;
}
else {
if (fErrorHandlerChanged) {
setErrorHandler(null);
fErrorHandlerChanged = false;
}
if (fResourceResolverChanged) {
setResourceResolver(null);
fResourceResolverChanged = false;
}
}
|
public void | setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
fErrorHandlerChanged = (errorHandler != null);
fComponentManager.setErrorHandler(errorHandler);
|
public void | setFeature(java.lang.String name, boolean value)
if (name == null) {
throw new NullPointerException();
}
try {
fComponentManager.setFeature(name, value);
}
catch (XMLConfigurationException e) {
final String identifier = e.getIdentifier();
final String key = e.getType() == XMLConfigurationException.NOT_RECOGNIZED ?
"feature-not-recognized" : "feature-not-supported";
throw new SAXNotRecognizedException(
SAXMessageFormatter.formatMessage(Locale.getDefault(),
key, new Object [] {identifier}));
}
fConfigurationChanged = true;
|
public void | setProperty(java.lang.String name, java.lang.Object object)
if (name == null) {
throw new NullPointerException();
}
if (CURRENT_ELEMENT_NODE.equals(name)) {
throw new SAXNotSupportedException(
SAXMessageFormatter.formatMessage(Locale.getDefault(),
"property-read-only", new Object [] {name}));
}
try {
fComponentManager.setProperty(name, object);
}
catch (XMLConfigurationException e) {
final String identifier = e.getIdentifier();
final String key = e.getType() == XMLConfigurationException.NOT_RECOGNIZED ?
"property-not-recognized" : "property-not-supported";
throw new SAXNotRecognizedException(
SAXMessageFormatter.formatMessage(Locale.getDefault(),
key, new Object [] {identifier}));
}
fConfigurationChanged = true;
|
public void | setResourceResolver(org.w3c.dom.ls.LSResourceResolver resourceResolver)
fResourceResolverChanged = (resourceResolver != null);
fComponentManager.setResourceResolver(resourceResolver);
|
public void | validate(javax.xml.transform.Source source, javax.xml.transform.Result result)
if (source instanceof SAXSource) {
// Hand off to SAX validator helper.
if (fSAXValidatorHelper == null) {
fSAXValidatorHelper = new ValidatorHandlerImpl(fComponentManager);
}
fSAXValidatorHelper.validate(source, result);
}
else if (source instanceof DOMSource) {
// Hand off to DOM validator helper.
if (fDOMValidatorHelper == null) {
fDOMValidatorHelper = new DOMValidatorHelper(fComponentManager);
}
fDOMValidatorHelper.validate(source, result);
}
else if (source instanceof StreamSource) {
// Hand off to stream validator helper.
if (fStreamValidatorHelper == null) {
fStreamValidatorHelper = new StreamValidatorHelper(fComponentManager);
}
fStreamValidatorHelper.validate(source, result);
}
// Source parameter cannot be null.
else if (source == null) {
throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
"SourceParameterNull", null));
}
// Source parameter must be a SAXSource, DOMSource or StreamSource
else {
throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
"SourceNotAccepted", new Object [] {source.getClass().getName()}));
}
|