Xml

Creates new documents from elements within XML. This module will either ignore input documents and use specificed XML content or use the content from input documents depending on how it's configured. An XPath expression can be used to find target XML elements, and the InnerXml of each child element of the target elements as well as the values of each attribute will be placed into the metadata of the generated documents.

Usage

  • Xml()

    Creates new documents from input documents. The child elements of the root element will be used.

  • Xml(string itemXPath)

    Creates new documents from input documents.

    • itemXPath

      The XPath expression to use to find child items. If null, all child elements will be used.

  • Xml(string data, string itemXPath)

    Creates new documents from the specified XML data.

    • data

      The XML data.

    • itemXPath

      The XPath expression to use to find child items. If null, all child elements will be used.

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • AddKeyConversion(string originalKeyName, string newKeyName)

    Allows renaming of keys during document creation: "If you find key X, create it as key Y instead."

    • originalKeyName

      The name of the original key to convert.

    • newKeyName

      The name you want to convert the key to.

  • ExcludeKeys(params string[] keys)

    Allows creation of a list of keys to discard.

    • keys

      The keys to discard.

  • IncludeKeys(params string[] keys)

    Allows creation of a list of keys to keep. If this list any members, any keys other than those in this list will be discarded.

    • keys

      The keys to keep.

  • WithContentKey(string contentKey)

    Specifies which metakey should be used for the document content

    • contentKey

      The name of the content property.

  • WithItemXPath(string itemXPath)

    Sets the XPath expression to use to find child items. If null, all child elements will be used.

    • itemXPath

      The XPath expression to use.

  • WithLimit(int limit)

    Limits the number of created documents.

    • limit

      The number of objects to create documents from.

  • WithMetadataXPath(string key, string xpath)

    Adds additional XPath patterns to be run on each element and assigned to a metadata key. To be safe, these patterns should start with "./" so they scope only to the element. The InnerXml of the first matching node will be used as the value of the metadata.

    • key

      The metadata key to store the value in.

    • xpath

      The XPath expression for the additional metadata.

GitHub