Class StaxParserUtil

    • Constructor Detail

      • StaxParserUtil

        public StaxParserUtil()
    • Method Detail

      • getAttributeValue

        public static String getAttributeValue​(Attribute attribute)
        Given an Attribute, get its trimmed value
        Parameters:
        attribute -
        Returns:
      • getStartElementName

        public static String getStartElementName​(StartElement startElement)
        Return the name of the start element
        Parameters:
        startElement -
        Returns:
      • trim

        public static final String trim​(String inputStr)
        Given a string, trim it
        Parameters:
        inputStr -
        Returns:
      • missingRequired

        public static XMLStreamException missingRequired​(XMLStreamReader reader,
                                                         Set<?> required)
        Get an exception reporting a missing, required XML attribute.
        Parameters:
        reader - the stream reader
        required - a set of enums whose toString method returns the attribute name
        Returns:
        the exception
      • unexpectedElement

        public static XMLStreamException unexpectedElement​(XMLStreamReader reader)
        Get an exception reporting an unexpected XML element.
        Parameters:
        reader - the stream reader
        Returns:
        the exception
      • unexpectedElement

        public static XMLStreamException unexpectedElement​(String elementName,
                                                           XMLEvent event)
        Get an exception reporting an unexpected XML element.
        Parameters:
        elementName - the unexpected element name
        event - the XML event
        Returns:
        the constructed exception
      • unexpectedNS

        public static XMLStreamException unexpectedNS​(String namespaceURI,
                                                      XMLEvent event)
        Get an exceptioon reporting an unexpected nasmespace URI.
        Parameters:
        namespaceURI - the unexpected namespace URI.
        Returns:
        the constructed exception.
      • unexpectedAttribute

        public static XMLStreamException unexpectedAttribute​(XMLStreamReader reader,
                                                             int index)
        Get an exception reporting an unexpected XML attribute.
        Parameters:
        reader - the stream reader
        index - the attribute index
        Returns:
        the exception