Class DebugValidateXML


  • public final class DebugValidateXML
    extends Object
    A class used to make sure the HTML/XML generated by each WComponent is well formed. DebugUtil is used to determine if XML Validation is enabled. As each WComponent paints its output, and if XML validation is enabled, WComponent calls this class to verify the HTML/XML. If a WComponent has badly formed HTML/XML, then an error message, along with the component details are stored in a framework attribute to be retrieved later by the ValidateXMLInterceptor so they can be reported in the response HTML.
    Since:
    1.0.0
    Author:
    Jonathan Austin
    • Method Detail

      • isEnabled

        public static boolean isEnabled()
        Check if Validate XML is enabled.
        Returns:
        true or false
      • validateXMLAgainstSchema

        public static String validateXMLAgainstSchema​(String xml)
        Validate the component to make sure the generated XML is schema compliant.
        Parameters:
        xml - the xml to validate
        Returns:
        Any errors found, or null if the XML is valid.
      • wrapXMLInRootElement

        public static String wrapXMLInRootElement​(String xml)
        Wrap the XML in a root element before validating.
        Parameters:
        xml - the XML to wrap
        Returns:
        the XML wrapped in a root element
      • getSchemaPath

        protected static String getSchemaPath()
        Return the path to the schema to test against. This can be overridden if client applications wish to validate their own components.
        Returns:
        the schema path for the current theme in use.