Package io.github.microcks.util
Class XmlSchemaValidator
java.lang.Object
io.github.microcks.util.XmlSchemaValidator
Helper class for easy access to a Xml Schema validation. Validators embed an error handler and use a specific
LSResourceResolver allowing for resolving relative dependencies from provided XmlSchemas.
- Author:
- laurent
-
Method Summary
Modifier and TypeMethodDescriptionvalidateXml
(InputStream schemaStream, String xmlString) Validation the Xml string with provided stream on its Xml schema.validateXml
(InputStream schemaStream, String xmlString, String baseResourceUrl) Validation the Xml string with provided stream on its Xml schema.
-
Method Details
-
validateXml
Validation the Xml string with provided stream on its Xml schema.- Parameters:
schemaStream
- A stream on reference Xml SchemaxmlString
- String representation of Xml to validate- Returns:
- A list of validation errors that mey be empty if validation is ok
- Throws:
Exception
- if validator cannot be initialized (in case of malformed schema stream)
-
validateXml
public static List<String> validateXml(InputStream schemaStream, String xmlString, String baseResourceUrl) throws Exception Validation the Xml string with provided stream on its Xml schema. A resource URL can be provided to resolved relative includes found into Xml Schema stream.- Parameters:
schemaStream
- A stream on reference Xml SchemaxmlString
- String representation of Xml to validatebaseResourceUrl
- Base resource URL for resolving relative dependencies- Returns:
- A list of validation errors that mey be empty if validation is ok
- Throws:
Exception
- if validator cannot be initialized (in case of malformed schema stream)
-