Package org.springframework.util.xml
Class XmlValidationModeDetector
- java.lang.Object
- org.springframework.util.xml.XmlValidationModeDetector
public class XmlValidationModeDetector extends Object
Detects whether an XML stream is using DTD- or XSD-based validation.- Since:
- 2.0
- Author:
- Rob Harrop, Juergen Hoeller
Field Summary
Fields Modifier and Type Field Description static int
VALIDATION_AUTO
Indicates that the validation mode should be auto-guessed, since we cannot find a clear indication (probably choked on some special characters, or the like).static int
VALIDATION_DTD
Indicates that DTD validation should be used (we found a "DOCTYPE" declaration).static int
VALIDATION_NONE
Indicates that the validation should be disabled.static int
VALIDATION_XSD
Indicates that XSD validation should be used (found no "DOCTYPE" declaration).
Constructor Summary
Constructors Constructor Description XmlValidationModeDetector()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
detectValidationMode(InputStream inputStream)
Detect the validation mode for the XML document in the suppliedInputStream
.
Field Detail
VALIDATION_NONE
public static final int VALIDATION_NONE
Indicates that the validation should be disabled.- See Also:
- Constant Field Values
VALIDATION_AUTO
public static final int VALIDATION_AUTO
Indicates that the validation mode should be auto-guessed, since we cannot find a clear indication (probably choked on some special characters, or the like).- See Also:
- Constant Field Values
VALIDATION_DTD
public static final int VALIDATION_DTD
Indicates that DTD validation should be used (we found a "DOCTYPE" declaration).- See Also:
- Constant Field Values
VALIDATION_XSD
public static final int VALIDATION_XSD
Indicates that XSD validation should be used (found no "DOCTYPE" declaration).- See Also:
- Constant Field Values
Constructor Detail
XmlValidationModeDetector
public XmlValidationModeDetector()
Method Detail
detectValidationMode
public int detectValidationMode(InputStream inputStream) throws IOException
Detect the validation mode for the XML document in the suppliedInputStream
. Note that the suppliedInputStream
is closed by this method before returning.- Parameters:
inputStream
- the InputStream to parse- Throws:
IOException
- in case of I/O failure- See Also:
VALIDATION_DTD
,VALIDATION_XSD