public final class ValidatorHelper extends Object
Supports validation of XML Source objects and JAXB-bound objects against
one or more W3C XML Schema (XSD) files. Optionally handles XOP (XML-binary Optimized
Packaging) content during validation.
Schema resources are resolved from the classpath relative to
SchemaValidatorHandler. Validation errors and fatal errors are collected and
reported as a single TechnicalConnectorException; warnings are logged but do
not cause the validation to fail.
| Constructor and Description |
|---|
ValidatorHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
validate(Object jaxbObj,
Class xmlClass,
String rootSchemaFileLocation)
Validates a JAXB object against a single XSD schema file using an explicit JAXB class.
|
static void |
validate(Object jaxbObj,
String rootSchemaFileLocation)
Validates a JAXB object against a single XSD schema file.
|
static void |
validate(Source source,
boolean xop,
String... schemaLocations)
Validates an XML
Source against one or more XSD schema files, with optional
XOP processing support. |
static void |
validate(Source source,
String... schemaLocations)
Validates an XML
Source against one or more XSD schema files. |
public static void validate(Source source, boolean xop, String... schemaLocations) throws TechnicalConnectorException
Source against one or more XSD schema files, with optional
XOP processing support.source - the XML source to validatexop - true to enable XOP include handling during validationschemaLocations - one or more classpath-relative paths to XSD schema filesTechnicalConnectorException - if the source is not schema-valid, or if a
technical error occurs during parsing or validationpublic static void validate(Source source, String... schemaLocations) throws TechnicalConnectorException
Source against one or more XSD schema files.
Equivalent to calling validate(Source, boolean, String...) with
xop = false.
source - the XML source to validateschemaLocations - one or more classpath-relative paths to XSD schema filesTechnicalConnectorException - if the source is not schema-valid, or if a
technical error occurs during parsing or validationpublic static void validate(Object jaxbObj, String rootSchemaFileLocation) throws TechnicalConnectorException
The JAXB context is derived from the runtime class of jaxbObj.
Equivalent to calling validate(Object, Class, String) with
xmlClass = jaxbObj.getClass().
jaxbObj - the JAXB-bound object to validate; must not be nullrootSchemaFileLocation - classpath-relative path to the root XSD schema fileTechnicalConnectorException - if jaxbObj is null, is not
schema-valid, or if a technical error occurspublic static void validate(Object jaxbObj, Class xmlClass, String rootSchemaFileLocation) throws TechnicalConnectorException
The JAXB context is resolved via JaxbContextFactory for the given
xmlClass. The object is first serialised to a JAXBSource before
schema validation is applied.
jaxbObj - the JAXB-bound object to validate; must not be nullxmlClass - the class used to resolve the JAXBContextrootSchemaFileLocation - classpath-relative path to the root XSD schema fileTechnicalConnectorException - if jaxbObj is null, is not
schema-valid, or if a technical error occurs
Connector Packaging PERSAUDIOLOGIST 4.9.5 API
Copyright © {inceptionYear}-2026 eHealth. All Rights Reserved.