Class XMLUtils


public class XMLUtils extends Object
  • Constructor Details

    • XMLUtils

      public XMLUtils()
  • Method Details

    • isEmptyWhiteSpace

      public static boolean isEmptyWhiteSpace(XMLEvent event)
      Empty events are not helpful so this method checks to see if the event consists solely of whitespace or newline characters. Unfortunately, newlines and other extraneous characters are treated as new elements, so this function wraps a lot of those checks in one function.
      event - The input XMLEvent
      True if the XMLEvent is only whitespace, false if not.
    • isNotCruft

      public static boolean isNotCruft(XMLEvent event)
      Identifies XML events that may be populated but are not useful for extracting data.
      event - The XMLEvent in question
      True if the event is useful, false if not
    • addField

      public static String addField(String prefix, String field)
      Generates a nested field name by combining a field prefix to the current field name.
      prefix - The prefix to be added to the field name.
      field - The field name
      the prefix, followed by an underscore and the fieldname.
    • removeField

      public static String removeField(String prefix, String fieldName)
      Returns the field name from nested field names.
      fieldName - The nested field name
      The field name
    • hasAttributes

      public static boolean hasAttributes(XMLEvent event)
      Returns true if a given XMLEvent has attributes, false if not. Since only start elements can by definition have attributes, returns false if the event is not a start element.
      event - The XMLEvent in question
      True if the XMLEvent has attributes, false if not.