Class XmlParserHelper


  • public class XmlParserHelper
    extends java.lang.Object
    Provides common functionality used for XML parsing.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream getInputStreamForResource​(java.lang.String resource)
      Returns an input stream for the specified resource.
      <T> T getJaxbRoot​(java.io.InputStream stream, java.lang.Class<T> clazz, javax.xml.validation.Schema schema)  
      javax.xml.validation.Schema getSchema​(java.lang.String schemaResource)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XmlParserHelper

        public XmlParserHelper​(Context context)
    • Method Detail

      • getInputStreamForResource

        public java.io.InputStream getInputStreamForResource​(java.lang.String resource)
        Returns an input stream for the specified resource. First an attempt is made to load the resource via the Filer API and if that fails Class.getResourceAsStream(java.lang.String) is used.
        Parameters:
        resource - the resource to load
        Returns:
        an input stream for the specified resource or null in case resource cannot be loaded
      • getJaxbRoot

        public <T> T getJaxbRoot​(java.io.InputStream stream,
                                 java.lang.Class<T> clazz,
                                 javax.xml.validation.Schema schema)
                          throws XmlParsingException
        Throws:
        XmlParsingException