psdi.iface.stax

Class MXStAXParser

  • java.lang.Object
    • psdi.iface.stax.MXStAXParser


  • public class MXStAXParser
    extends java.lang.Object
    A StAX based utility for stream based parsing of XML files.
    • Method Detail

      • getInstance

        public static final MXStAXParser getInstance()
        Returns:
        the parser instance
      • getRootElementName

        public javax.xml.namespace.QName getRootElementName(byte[] data)
                                                     throws MXException
        Parameters:
        data -
        Returns:
        the qualified name of the root element
        Throws:
        MXException
      • parse

        public java.util.Map parse(byte[] data,
                                   java.util.Set tags)
                            throws javax.xml.stream.XMLStreamException
        Parameters:
        data -
        tags -
        Returns:
        the map of element names and their values
        Throws:
        javax.xml.stream.XMLStreamException
      • parse

        public java.util.Map parse(byte[] data,
                                   java.util.Set tags,
                                   boolean fetchAttrs)
                            throws javax.xml.stream.XMLStreamException
        Parameters:
        data -
        tags -
        fetchAttrs -
        Returns:
        the map of element names and their values
        Throws:
        javax.xml.stream.XMLStreamException
      • parse

        public java.util.Map parse(java.io.InputStream ip,
                                   java.util.Set tags,
                                   boolean fetchAttrs)
                            throws javax.xml.stream.XMLStreamException
        Parameters:
        ip -
        tags -
        fetchAttrs -
        Returns:
        the map of element names and their values
        Throws:
        javax.xml.stream.XMLStreamException
      • evaluateXPath

        public java.util.List evaluateXPath(byte[] data,
                                            java.lang.String xpath,
                                            java.util.Map prefixNSMap)
                                     throws MXException
        Throws:
        MXException
      • evaluateXPath

        public java.util.List evaluateXPath(byte[] data,
                                            XPathExpression xpathExpr)
                                     throws MXException
        Parameters:
        data - the xml bytes
        xpathExpr - the xpath expression
        Returns:
        the list of string values that matches the xpath expression
        Throws:
        javax.xml.stream.XMLStreamException
        MXException
      • removeXMLComments

        public byte[] removeXMLComments(byte[] xmlWithComments)
        Parameters:
        xmlWithComments -
        Returns:
        the modified xml bytes with comments removed