Class XmlParserHelper


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

      • XmlParserHelper

        public XmlParserHelper()
    • Method Detail

      • 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.
      • 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.