Class Parser

  • Direct Known Subclasses:
    ConfigurationParser, HybrisTypeSystemParser

    public class Parser
    extends java.lang.Object
    The xml parser class. Using it simply requires to provide a root TagListener and a {link org.xml.sax.InputSource}.

    Example:

            Media m = ...
            Parser p = new Parser();
            try
        {
                    p.parse(
                            new InputSource( m.getDataFromStream() ),
            new MyRootTagListener()
            );
        }
        catch( ParseAbortException e )
        {
            // do some error handling
        }
     
    • Constructor Detail

      • Parser

        public Parser​(ObjectProcessor processor,
                      java.util.Map props)
    • Method Detail

      • getSaxParser

        protected javax.xml.parsers.SAXParser getSaxParser()
      • getCurrentTagListener

        protected TagListener getCurrentTagListener()
      • createSaxParser

        protected final javax.xml.parsers.SAXParser createSaxParser​(java.util.Map props)
      • setFeatures

        protected void setFeatures​(java.util.Map props)
      • getDefaultFeatures

        protected java.util.Map getDefaultFeatures()
      • parse

        public void parse​(java.io.InputStream stream,
                          java.lang.String encoding,
                          TagListener root)
                   throws ParseAbortException
        Parses a given input source using the given root tag listener.

        This method accepts a data stream together with its encoding. It automatically wraps it into a UnicodeInputStream to work around the current utf-8 bom bug of the java vm.

        Parameters:
        stream - the data top parse
        encoding - encoding of data
        root - the root tag listener to call upon parsing
        Throws:
        ParseAbortException - in case of an parse error