Class XmlRecordPipelineInput

All Implemented Interfaces:
DataExceptionContributor, JsonSerializable, RecordSerializable, XmlSerializable, DataReaderFactory, JavaCodeGenerator, Serializable

public class XmlRecordPipelineInput extends FileSourcePipelineInput
Reads a pipeline's source data from an XML FileSource using an XmlRecordReader, which turns each element matching a record break into one nested record.
See Also:
  • Constructor Details

    • XmlRecordPipelineInput

      public XmlRecordPipelineInput()
  • Method Details

    • createDataReader

      public DataReader createDataReader()
    • getFileSource

      public FileSource getFileSource()
      Specified by:
      getFileSource in class FileSourcePipelineInput
    • setFileSource

      public XmlRecordPipelineInput setFileSource(FileSource fileSource)
      Specified by:
      setFileSource in class FileSourcePipelineInput
    • getName

      public String getName()
      Description copied from class: PipelineInput
      Returns a display name for this input, such as the source's name followed by its format.
      Overrides:
      getName in class FileSourcePipelineInput
    • getRecordBreaks

      public List<String> getRecordBreaks()
      Returns the location paths of the elements read as records or null if none were added.
    • getRecordBreaks

      public List<String> getRecordBreaks(boolean create)
      Returns the record break paths, first creating an empty list if create is true and there is none.
    • addRecordBreak

      public XmlRecordPipelineInput addRecordBreak(String locationPathAsString)
      Adds a location path, such as /teachers/teacher, whose matching elements are each read as a record.
    • isDebug

      public boolean isDebug()
      Indicates if the reader logs each parsed node to help find record break paths; not serialized (defaults to false).
    • setDebug

      public XmlRecordPipelineInput setDebug(boolean debug)
      Indicates if the reader logs each parsed node to help find record break paths; not serialized (defaults to false).
    • isIgnoreEmptyText

      public boolean isIgnoreEmptyText()
    • setIgnoreEmptyText

      public XmlRecordPipelineInput setIgnoreEmptyText(boolean ignoreEmptyText)
    • isMapTextRecordsToFields

      public boolean isMapTextRecordsToFields()
      Indicates if text-only elements become simple values instead of nested records with a $text field (defaults to true).
    • setMapTextRecordsToFields

      public XmlRecordPipelineInput setMapTextRecordsToFields(boolean mapTextRecordsToFields)
      Indicates if text-only elements become simple values instead of nested records with a $text field (defaults to true).
    • isAddTextToParent

      public boolean isAddTextToParent()
      Indicates if each child element's text is also added to its parent's text (defaults to false); this uses more memory.
    • setAddTextToParent

      public XmlRecordPipelineInput setAddTextToParent(boolean addTextToParent)
      Indicates if each child element's text is also added to its parent's text (defaults to false); this uses more memory.
    • isIgnoreNamespaces

      public boolean isIgnoreNamespaces()
      Indicates if namespaces on elements and attributes are removed (defaults to true); false is not supported.
    • setIgnoreNamespaces

      public XmlRecordPipelineInput setIgnoreNamespaces(boolean ignoreNamespaces)
      Indicates if namespaces on elements and attributes are removed (defaults to true); false is not supported.
    • isAutoCloseReader

      public boolean isAutoCloseReader()
      Indicates if the file's stream is closed when the reader is closed (defaults to true).
    • setAutoCloseReader

      public XmlRecordPipelineInput setAutoCloseReader(boolean autoCloseReader)
      Indicates if the file's stream is closed when the reader is closed (defaults to true).
    • isLineageSupported

      public boolean isLineageSupported()
      Description copied from class: PipelineInput
      Indicates if this input can save data lineage on the records it reads (false unless a subclass overrides it).
      Overrides:
      isLineageSupported in class PipelineInput
    • generateJavaCode

      public void generateJavaCode(JavaCodeBuilder code)
      Description copied from interface: JavaCodeGenerator
      Appends Java source code representing this object to the given builder.
    • toRecord

      public Record toRecord()
      Description copied from interface: RecordSerializable
      Converts this object's state to a record that RecordSerializable.fromRecord(Record) can load.
      Specified by:
      toRecord in interface RecordSerializable
      Overrides:
      toRecord in class PipelineInput
    • fromRecord

      public XmlRecordPipelineInput fromRecord(Record source)
      Description copied from interface: RecordSerializable
      Loads this instance's state from a record and returns this (for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.
      Specified by:
      fromRecord in interface RecordSerializable
      Overrides:
      fromRecord in class PipelineInput
      Parameters:
      source -
      Returns:
      this instance.
    • toXmlElement

      public Element toXmlElement(Document document)
      Description copied from interface: XmlSerializable
      Returns an element, created with document, describing this object; the default implementation throws a DataException.
      Specified by:
      toXmlElement in interface XmlSerializable
      Overrides:
      toXmlElement in class PipelineInput
    • fromXmlElement

      public XmlRecordPipelineInput fromXmlElement(Element pipelineInputElement)
      Specified by:
      fromXmlElement in interface XmlSerializable
      Overrides:
      fromXmlElement in class PipelineInput