Class SiteCatalogXMLMetadataParser

  • All Implemented Interfaces:
    org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

    class SiteCatalogXMLMetadataParser
    extends Parser
    A lightweight XML Parser class to just retrieve the meta data in first instance of an element in a XML Document. It used to get the metadata in the root element.
    Author:
    Karan Vahi
    • Field Detail

      • mElement

        private java.lang.String mElement
        The root element name to look for.
      • mMetadata

        private java.util.Map<java.lang.String,​java.lang.String> mMetadata
        The Metadata object that has to be returned.
      • mParsingDone

        protected boolean mParsingDone
        A boolean indicating that parsing is done.
    • Constructor Detail

      • SiteCatalogXMLMetadataParser

        public SiteCatalogXMLMetadataParser​(PegasusBag bag,
                                            java.lang.String element)
        The overloaded constructor
        Parameters:
        bag - the bag of intiialization documents
        element - the root element
    • Method Detail

      • getMetadata

        public java.util.Map<java.lang.String,​java.lang.String> getMetadata()
        Returns the metadata/attributes assoicated with the element that was parsed for.
        Returns:
      • startElement

        public void startElement​(java.lang.String uri,
                                 java.lang.String local,
                                 java.lang.String raw,
                                 org.xml.sax.Attributes attrs)
                          throws org.xml.sax.SAXException
        Start Element.
        Specified by:
        startElement in interface org.xml.sax.ContentHandler
        Specified by:
        startElement in class Parser
        Parameters:
        uri -
        local -
        raw -
        attrs -
        Throws:
        org.xml.sax.SAXException
      • endElement

        public void endElement​(java.lang.String uri,
                               java.lang.String localName,
                               java.lang.String qName)
                        throws org.xml.sax.SAXException
        An empty implementation
        Specified by:
        endElement in interface org.xml.sax.ContentHandler
        Specified by:
        endElement in class Parser
        Parameters:
        uri -
        localName -
        qName -
        Throws:
        org.xml.sax.SAXException
      • endDocument

        public void endDocument()
        Sets the boolean indicating parsing is done
        Specified by:
        endDocument in interface org.xml.sax.ContentHandler
        Specified by:
        endDocument in class Parser
      • startParser

        public void startParser​(java.lang.String file)
        The function that starts the parser
        Specified by:
        startParser in class Parser
        Parameters:
        file - the file to be parsed
      • getSchemaLocation

        public java.lang.String getSchemaLocation()
        Not implemented as yet
        Specified by:
        getSchemaLocation in class Parser
        Returns:
      • getSchemaNamespace

        public java.lang.String getSchemaNamespace()
        Not implemented as yet
        Specified by:
        getSchemaNamespace in class Parser
        Returns: