Class used to validate XML. This is used to check if the XML created during a marshal operation would be valid XML before the marshal operation is performed.
Create an XMLValidator from an XMLContext.
Code Sample
XMLContext context = new XMLContext("mySessionName");
XMLValidator validator = context.createValidator();
The validateRoot method is used to validate objects which are mapped to global elements in a schema and which have a default root element specified in the TopLink project. The validate method is used to validate all other mapped objects.
org.eclipse.persistence.oxm.XMLContext
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| private ErrorHandler | |
| private XMLMarshaller | |
| public static final int | |
| public static final int | |
| private XMLContext |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public ErrorHandler | Returns: the error handler associated with this XMLValidatorGet the error handler to be used during validation |
| public void | setErrorHandler(ErrorHandler
the error handler to be used during validation handler)Set the error handler to be used during validation |
| public boolean | |
| public boolean | Returns: true if this is a valid object, otherwise falseA single root object to validate rootObject)Validate the given root object. |
| DTD_VALIDATION | back to summary |
|---|---|
| public static final int DTD_VALIDATION | |
| errorHandler | back to summary |
|---|---|
| private ErrorHandler errorHandler | |
| marshaller | back to summary |
|---|---|
| private XMLMarshaller marshaller | |
| NONVALIDATING | back to summary |
|---|---|
| public static final int NONVALIDATING | |
| SCHEMA_VALIDATION | back to summary |
|---|---|
| public static final int SCHEMA_VALIDATION | |
| xmlContext | back to summary |
|---|---|
| private XMLContext xmlContext | |
| XMLValidator | back to summary |
|---|---|
| protected XMLValidator(XMLContext xmlContext) | |
| getErrorHandler | back to summary |
|---|---|
| public ErrorHandler getErrorHandler() Get the error handler to be used during validation
| |
| setErrorHandler | back to summary |
|---|---|
| public void setErrorHandler(ErrorHandler handler) Set the error handler to be used during validation
| |
| validate | back to summary |
|---|---|
| public boolean validate(Object object) throws XMLMarshalException Validate the given object.
| |
| validateRoot | back to summary |
|---|---|
| public boolean validateRoot(Object rootObject) throws XMLMarshalException Validate the given root object.
| |