Custom Export right arrow Custom Export Template

You can export data in the database as virtually any kind of document by providing Helium Scraper with an XML template. To export the contents of a table, place an expand element with the columns attribute set to the columns to be used separated by commas, inside a query element with the source attribute set to the table name.

You can use nested expand elements to create multi-level outputs where the content of the child expand corresponds to the content of the parent expand in the data table.

These are the elements that can be used inside a template XML:

template

This is the root element. Must contain a head and a body elements. Cannot contain text.

head

Contains an optional script element. Cannot contain text.

body

May contain text or one or more query elements.

script

Can contain a set of JavaScipt functions that receive the current value of an insert element and return a modified value to be inserted. The format attribute of the insert element must be set to the name of the function to be used.

query

Can contain one or more expand elements. Represents the FROM section of an SQL query from which its child expand elements will take their data. Cannot contain text.

Attributes:
source Receives the table name or the JOIN section of an SQL query
expand

Performs a query using the parent query element's source and repeatedly outputs its content for each unique occurrence of the values in the given columns. Nested expand elements will output only rows that have the same values as the current values in every column that is available in every parent expand element.

This element can contain text, other expand elements, and insert and columns elements.

Attributes:
columns The columns that should be accessible from all the child nodes separated by commas. This attribute will be directly injected into an SQL query. Therefore, can contain SQL functions and columns must be enclosed in square brackets if necessary.
order_by Optional. The column by which to order the results.
order_desc Optional. Specifies whether to sort in descending order or not. Must be "true" or "false".
separator Optional. Lets you assign a text that will be inserted between each generated output.
insert

Outputs the current value of the given column. Cannot contain text or any other element.

Attributes:
column The column from which to output it's value.
format Optional. Modifies the output value by passing it to a script and receiving the modified value. The following built-in formats are available:
  • AsXmlText: Escapes the characters <, >, and &.
  • AsXmlAttribute: Escapes the characters <, >, ", ', & and newlines.
  • AsQuotedXmlAttribute: Escapes AsXmlAttribute except for the ' character and surrounds the value in double quotes.
  • AsCDATA: Encloses the value in a CDATA section, replacing every occurrence of "]]>" for "]]]]><![CDATA[>" to prevent exiting the current CDATA section without modifying the enclosed text.
columns

Repeats its content for every column in the current row being produced by an expand element. Can contain text, name and value elements.

Attributes:
separator Optional. Lets you assign a text that will be inserted between each generated output.
name

Outputs the name of the current column inside a columns element. Cannot contain text or any other element.

Attributes:
format Optional. Modifies the output value by passing it to a script and receiving the modified value. See the format attribute of the insert element for more details.
value

Outputs the value of the current column inside a columns element. Cannot contain text or any other element.

Attributes:
format Optional. Modifies the output value by passing it to a script and receiving the modified value. See the format attribute of the insert element for more details.