Package fr.gouv.vitam.common.xml
Class ValidationXsdUtils
- java.lang.Object
-
- fr.gouv.vitam.common.xml.ValidationXsdUtils
-
public class ValidationXsdUtils extends java.lang.Object
Class ValidationXsdUtils validate the file XML by XSD Method checkWithXSD return true if XSD validate the file XML, else return false
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CATALOG_FILENAME
Filename of the catalog file ; should be found in the classpath.static java.lang.String
HTTP_WWW_W3_ORG_XML_XML_SCHEMA_V1_1
static java.lang.String
RNG_FACTORY
static java.lang.String
RNG_PROPERTY_KEY
-
Constructor Summary
Constructors Constructor Description ValidationXsdUtils()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkFileRNG(java.io.InputStream xmlFile, java.io.File xsdFile)
boolean
checkFileXSD(java.io.InputStream xmlFile, java.io.File xsdFile)
boolean
checkWithXSD(java.io.InputStream xmlFile, java.lang.String xsdFile)
static ValidationXsdUtils
getInstance()
-
-
-
Field Detail
-
RNG_FACTORY
public static final java.lang.String RNG_FACTORY
- See Also:
- Constant Field Values
-
RNG_PROPERTY_KEY
public static final java.lang.String RNG_PROPERTY_KEY
- See Also:
- Constant Field Values
-
HTTP_WWW_W3_ORG_XML_XML_SCHEMA_V1_1
public static final java.lang.String HTTP_WWW_W3_ORG_XML_XML_SCHEMA_V1_1
- See Also:
- Constant Field Values
-
CATALOG_FILENAME
public static final java.lang.String CATALOG_FILENAME
Filename of the catalog file ; should be found in the classpath.- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static ValidationXsdUtils getInstance()
-
checkWithXSD
public boolean checkWithXSD(java.io.InputStream xmlFile, java.lang.String xsdFile) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.stream.XMLStreamException
- Parameters:
xmlFile
- the file to validatexsdFile
- the xsd schema to validate with the file- Returns:
- true(if XSD validate the file XML)
- Throws:
java.io.FileNotFoundException
- if the file is not foundjavax.xml.stream.XMLStreamException
- if it couldnt create an xml stream readerorg.xml.sax.SAXException
- if the file is not valid with the XSD, or the file is not an xml filejava.io.IOException
- if the schema file could not be found
-
checkFileXSD
public boolean checkFileXSD(java.io.InputStream xmlFile, java.io.File xsdFile) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.stream.XMLStreamException
- Parameters:
xmlFile
-xsdFile
-- Returns:
- true if validated
- Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.stream.XMLStreamException
-
checkFileRNG
public boolean checkFileRNG(java.io.InputStream xmlFile, java.io.File xsdFile) throws org.xml.sax.SAXException, java.io.IOException
- Parameters:
xmlFile
-xsdFile
-- Returns:
- true if validated
- Throws:
org.xml.sax.SAXException
java.io.IOException
-
-