Package fr.gouv.vitam.common.xml
Class ValidationXsdUtils
- java.lang.Object
-
- fr.gouv.vitam.common.xml.ValidationXsdUtils
-
public class ValidationXsdUtils extends java.lang.ObjectClass 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.StringCATALOG_FILENAMEFilename of the catalog file ; should be found in the classpath.static java.lang.StringHTTP_WWW_W3_ORG_XML_XML_SCHEMA_V1_1static java.lang.StringRNG_FACTORYstatic java.lang.StringRNG_PROPERTY_KEY
-
Constructor Summary
Constructors Constructor Description ValidationXsdUtils()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckFileRNG(java.io.InputStream xmlFile, java.io.File xsdFile)booleancheckFileXSD(java.io.InputStream xmlFile, java.io.File xsdFile)booleancheckWithXSD(java.io.InputStream xmlFile, java.lang.String xsdFile)static ValidationXsdUtilsgetInstance()static javax.xml.validation.SchemagetSchema(java.io.File file)
-
-
-
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.SAXExceptionjava.io.IOExceptionjavax.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.SAXExceptionjava.io.IOException
-
getSchema
public static javax.xml.validation.Schema getSchema(java.io.File file) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
-