Class XmlParserHelper

java.lang.Object
org.hibernate.validator.internal.xml.XmlParserHelper

public class XmlParserHelper extends Object
Provides common functionality used within the different XML descriptor parsers.
Author:
Gunnar Morling
  • Constructor Details

    • XmlParserHelper

      public XmlParserHelper()
  • Method Details

    • getSchemaVersion

      public String getSchemaVersion(String resourceName, XMLEventReader xmlEventReader)
      Retrieves the schema version applying for the given XML input stream as represented by the "version" attribute of the root element of the stream.

      The given reader will be advanced to the root element of the given XML structure. It can be used for unmarshalling from there.

      Parameters:
      resourceName - The name of the represented XML resource.
      xmlEventReader - An STAX event reader
      Returns:
      The value of the "version" attribute. For compatibility with BV 1.0, "1.0" will be returned if the given stream doesn't have a "version" attribute.
    • createXmlEventReader

      public XMLEventReader createXmlEventReader(String resourceName, InputStream xmlStream)
    • getSchema

      public Schema getSchema(String schemaResource)
      Returns the XML schema identified by the given resource name.
      Parameters:
      schemaResource - the resource name identifying the schema.
      Returns:
      the schema identified by the given resource name or null if the resource was not found or could not be loaded.