Package org.apache.drill.exec.store.xml
Class XMLUtils
java.lang.Object
org.apache.drill.exec.store.xml.XMLUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Generates a nested field name by combining a field prefix to the current field name.static boolean
hasAttributes
(XMLEvent event) Returns true if a given XMLEvent has attributes, false if not.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.static boolean
isNotCruft
(XMLEvent event) Identifies XML events that may be populated but are not useful for extracting data.static String
removeField
(String prefix, String fieldName) Returns the field name from nested field names.
-
Constructor Details
-
XMLUtils
public XMLUtils()
-
-
Method Details
-
isEmptyWhiteSpace
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.- Parameters:
event
- The input XMLEvent- Returns:
- True if the XMLEvent is only whitespace, false if not.
-
isNotCruft
Identifies XML events that may be populated but are not useful for extracting data.- Parameters:
event
- The XMLEvent in question- Returns:
- True if the event is useful, false if not
-
addField
Generates a nested field name by combining a field prefix to the current field name.- Parameters:
prefix
- The prefix to be added to the field name.field
- The field name- Returns:
- the prefix, followed by an underscore and the fieldname.
-
removeField
Returns the field name from nested field names.- Parameters:
fieldName
- The nested field name- Returns:
- The field name
-
hasAttributes
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.- Parameters:
event
- The XMLEvent in question- Returns:
- True if the XMLEvent has attributes, false if not.
-