Package org.eclipse.persistence.oxm
Class XMLValidator
java.lang.Object
org.eclipse.persistence.oxm.XMLValidator
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.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the error handler to be used during validationvoid
setErrorHandler
(ErrorHandler handler) Set the error handler to be used during validationboolean
Validate the given object.boolean
validateRoot
(Object rootObject) Validate the given root object.
-
Field Details
-
NONVALIDATING
public static final int NONVALIDATING- See Also:
-
SCHEMA_VALIDATION
public static final int SCHEMA_VALIDATION- See Also:
-
DTD_VALIDATION
public static final int DTD_VALIDATION- See Also:
-
-
Constructor Details
-
XMLValidator
-
-
Method Details
-
validateRoot
Validate the given root object.- Parameters:
rootObject
- A single root object to validate- Returns:
- true if this is a valid object, otherwise false
- Throws:
XMLMarshalException
-
validate
Validate the given object.- Parameters:
object
- A single object to validate- Returns:
- true if this is a valid object, otherwise false
- Throws:
XMLMarshalException
-
setErrorHandler
Set the error handler to be used during validation- Parameters:
handler
- the error handler to be used during validation
-
getErrorHandler
Get the error handler to be used during validation- Returns:
- the error handler associated with this XMLValidator
-