Houdini 18.0 Nodes TOP nodes

Xml Input TOP node

Extracts data from XML into Work Item attributes

On this page

This node parses XML data and can extract complete elements, attributes or text values into Work Item attributes. The query can be specified using either XPath, or through simplified name-based matching parameters.

Note

XPath 1.0 is supported with the lxml library.

Parameters

Work Item Generation

Whether this node generates static or dynamic work items. You should generally leave this set to "Automatic" unless you know the node’s work items can be computed statically, or that they need to be generated dynamically.

Dynamic

This node always creates dynamic work items: it waits until the upstream work items are known, and generates new work items from the upstream work items.

Static

This node always creates static work items: it creates the number of work items it thinks it needs based on the parameters (and any upstream static items) before the network runs.

Automatic

If the input is static (a static processor, or a partitioner with only static inputs, or a mapper), this node generates static work items, otherwise it generates dynamic work items.

Source

XML Source

Upstream XML File: Reads from input file with the given File Tag.

Custom File Path: Reads from the given XML File path.

Upstream XML Attribute: Reads from an attribute given by the Attribute Name on the upstream Work Item. This can be a File or string attribute.

Custom String: Reads from the given string value.

File Tag

#id sourcefiletag

The file tag of the upstream file.

XML File

The filepath of the XML file that should be parsed.

Attribute Name

The name of the attribute from which to read XML data.

XML

The XML string to parse.

Query

Query Method

XPath: Use an XPath expression. XPath is a full-featured query language for XML documents. The expression can return single attribute values, complete elements or lists of results.

By Element Name: Use the given parameters to specify an element name and optionally attribute name to match.

Match

Any Elements: Match any elements in the XML source.

Child Elements: Match only child elements of the active element. (Not the active element itself)

XPath Expression

The XPath expression to be evaluated. Note that the 'active element' is the root element of the upstream XML data.

Element Tag

The name of the XML element to be matched.

Extract

Element: Extract the complete matched element, which is everything between the start and end tags.

Element Text: Extract the text value of the element. For example Test, the string 'Test' would be extracted.

Attribute: Extract the value of the supplied Attribute Name.

Attribute Name

The name of the attribute to extract. The value can be converted from the read string using Match Storage Type.

No Match

Add Warning: Adds a warning to the node but does not fail.

Raise Error: Issues a fatal error which stops the cook.

Generate Item: Creates an empty item representing the failed match.

Storage

Create Work Item

For Each Match: One Work Item is created for each match result.

For All Matches: One Work Item is created for all results. This may result in array attributes to hold the result values.

Match Storage Type

Element: The query result must be an Element, and it will be written out as either an XML string attribute or an XML file.

String: The query result(s) will be converted to a string attribute.

Integer: The query result(s) will be converted to an integer attribute.

Float: The query result(s) will be converted to a float attribute.

File: The query result(s) will be converted to a file path.

Store Element Match

When the Match Storage Type is Element, how to save it.

As String Attribute: Save the Element as an XML fragment in a string attribute.

Write To File: Write the XML element(s) to a file.

Attribute Name

The name of the attribute that gets created to hold the extracted data.

File Path

The path to a file to be created when Write To File is active.

Root Name

When Create Work Item is set to For All Matches and Store Element Match is set to Write To File, the matching Element(s) will be children of this Root.

Examples

example_top_xmlinput Example for Xml Input TOP node

This example demonstrates how to use the xml input node in PDG/TOPs.

TOP nodes