Class ValidationHelper


  • public class ValidationHelper
    extends Object
    Can validate xml against xsd generated from fryske akademy tei dictionaries customization
    • Field Detail

      • CLASSPATH_URI_DICTIONARY_XSD

        public static final String CLASSPATH_URI_DICTIONARY_XSD
        Can be used in schemaLocation attribute to import xsd groups to define complex types using <xs:group ref="...."/>
        See Also:
        Constant Field Values
    • Constructor Detail

      • ValidationHelper

        public ValidationHelper()
    • Method Detail

      • fromXML

        public static <T> T fromXML​(Reader xml,
                                    Class<T> clazz)
                             throws jakarta.xml.bind.JAXBException
        Throws:
        jakarta.xml.bind.JAXBException
      • fromXML

        public static <T> T fromXML​(Reader xml,
                                    Class<T> clazz,
                                    boolean validate)
                             throws jakarta.xml.bind.JAXBException
        Throws:
        jakarta.xml.bind.JAXBException
      • toXML

        public static String toXML​(Object teiObject)
                            throws jakarta.xml.bind.JAXBException
        Throws:
        jakarta.xml.bind.JAXBException
      • toXML

        public static void toXML​(Object teiObject,
                                 Writer w,
                                 boolean validate)
                          throws jakarta.xml.bind.JAXBException
        Throws:
        jakarta.xml.bind.JAXBException
      • getJAXBCONTEXT

        public static jakarta.xml.bind.JAXBContext getJAXBCONTEXT()
      • getSchema

        public static Schema getSchema()
      • validateXsdSchematron

        public static void validateXsdSchematron​(URL xml)
                                          throws IOException,
                                                 name.dmaus.schxslt.SchematronException,
                                                 SAXException
        perform xsd validation and validation based on schematron.
        Parameters:
        xml - a url (file, classpath, network...) to the xml to be validated
        Throws:
        IOException
        name.dmaus.schxslt.SchematronException
        SAXException
      • validateSchematron

        public static void validateSchematron​(URL xml)
                                       throws IOException,
                                              name.dmaus.schxslt.SchematronException
        validates using schematron only
        Parameters:
        xml -
        Throws:
        ValidationException - when validation fails
        IOException
        name.dmaus.schxslt.SchematronException
      • validateXsdSchematron

        public static void validateXsdSchematron​(String xml)
                                          throws Exception
        perform sxd validation and validation based on schematron.
        Parameters:
        xml - the xml as a string
        Throws:
        SAXException - when validation fails, exception holds useful information
        Exception - if anything goes wrong
      • validateSchematron

        public static void validateSchematron​(String xml)
                                       throws name.dmaus.schxslt.SchematronException
        validates using schematron only
        Parameters:
        xml -
        Throws:
        ValidationException - when validation fails
        name.dmaus.schxslt.SchematronException