Package org.codehaus.stax2.validation
Class XMLValidationProblem
- java.lang.Object
-
- org.codehaus.stax2.validation.XMLValidationProblem
-
public class XMLValidationProblem extends java.lang.Object
Simple container class used to store a non-fatal problem either to be returned as is, or to use for creating and throwing a validation exception.
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.xml.stream.Location
mLocation
Location within validated xml stream where the problem occured.protected java.lang.String
mMessage
protected XMLValidator
mReporter
Validator instance that reported the problem, if any (may be null if stream reader or writer itself reported the problem)protected int
mSeverity
protected java.lang.String
mType
Type of the problem, available types implementation specified.static int
SEVERITY_ERROR
static int
SEVERITY_FATAL
static int
SEVERITY_WARNING
-
Constructor Summary
Constructors Constructor Description XMLValidationProblem(javax.xml.stream.Location loc, java.lang.String msg)
XMLValidationProblem(javax.xml.stream.Location loc, java.lang.String msg, int severity)
XMLValidationProblem(javax.xml.stream.Location loc, java.lang.String msg, int severity, java.lang.String type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.xml.stream.Location
getLocation()
java.lang.String
getMessage()
XMLValidator
getReporter()
Returns the validator that reported the problem if known.int
getSeverity()
java.lang.String
getType()
void
setLocation(javax.xml.stream.Location l)
void
setReporter(XMLValidator v)
Set the validator object that reported this problem, if known.void
setType(java.lang.String t)
XMLValidationException
toException()
Convenience method for constructing aXMLValidationException
to throw based on information contained in this object.
-
-
-
Field Detail
-
SEVERITY_WARNING
public static final int SEVERITY_WARNING
- See Also:
- Constant Field Values
-
SEVERITY_ERROR
public static final int SEVERITY_ERROR
- See Also:
- Constant Field Values
-
SEVERITY_FATAL
public static final int SEVERITY_FATAL
- See Also:
- Constant Field Values
-
mLocation
protected javax.xml.stream.Location mLocation
Location within validated xml stream where the problem occured.
-
mMessage
protected final java.lang.String mMessage
-
mSeverity
protected final int mSeverity
-
mType
protected java.lang.String mType
Type of the problem, available types implementation specified.- Since:
- 3.0
-
mReporter
protected XMLValidator mReporter
Validator instance that reported the problem, if any (may be null if stream reader or writer itself reported the problem)- Since:
- 3.0
-
-
Constructor Detail
-
XMLValidationProblem
public XMLValidationProblem(javax.xml.stream.Location loc, java.lang.String msg)
-
XMLValidationProblem
public XMLValidationProblem(javax.xml.stream.Location loc, java.lang.String msg, int severity)
-
XMLValidationProblem
public XMLValidationProblem(javax.xml.stream.Location loc, java.lang.String msg, int severity, java.lang.String type)
-
-
Method Detail
-
toException
public XMLValidationException toException()
Convenience method for constructing aXMLValidationException
to throw based on information contained in this object. Base implementation is equivalent to:return XMLValidationException.createException(this);
- Since:
- 3.0
-
setType
public void setType(java.lang.String t)
- Since:
- 3.0
-
setLocation
public void setLocation(javax.xml.stream.Location l)
- Since:
- 3.0
-
setReporter
public void setReporter(XMLValidator v)
Set the validator object that reported this problem, if known.- Since:
- 3.0
-
getLocation
public javax.xml.stream.Location getLocation()
- Returns:
- Reference to location where problem was encountered.
-
getMessage
public java.lang.String getMessage()
- Returns:
- Human-readable message describing the problem
-
getSeverity
public int getSeverity()
- Returns:
- One of
SEVERITY_
constants (such asSEVERITY_WARNING
-
getType
public java.lang.String getType()
- Returns:
- Generic type (class) of the problem; may be null if validator does not provide such details
- Since:
- 3.0
-
getReporter
public XMLValidator getReporter()
Returns the validator that reported the problem if known.- Returns:
- Validator that reported the problem; null if unknown or N/A.
- Since:
- 3.0
-
-