Skip to main content

Table.to_xml

to_xmlelement_columns attribute_columns value_column root_name row_name on_problems

Group: Conversions

Documentation

Returns an XML_Document representation of the table.

Arguments

  • element_columns: Columns to be used as elements in the XML.
  • attribute_columns: Columns to be used as attributes in the XML.
  • value_column: Column to be used as the value for the row tag in the XML.
  • root_name: The name of the root tag in the XML.
  • row_name: The name of the row tag in the XML.
  • on_problems: Specifies how to handle warnings if they occur, reporting them as warnings by default.

Examples

to_xml Operation

Input Table table:

     Title                  | Author              | Price | Year
------------------------+---------------------+-------+------
A Tale Of Two Cities | Charles Dickens | 9.99 | 1859
The Great Gatsby | F. Scott Fitzgerald | 5.99 | 1925

Result r = t.to_xml ["Year"] ["Author", "Price"] "Title" "Books" "Book":

     <Books>
<Book Author="Charles Dickens" Price="9.99">
A Tale Of Two Cities
<Year>1859</Year>
</Book>
<Book Author="F. Scott Fitzgerald" Price="5.99">
The Great Gatsby
<Year>1925</Year>
</Book>
</Books>

Errors

  • If a column in element_columns, attribute_columns or value_column is not in the input table, a Missing_Input_Columns is raised as an error.
  • If any incomming columns aree not specified in one of element_columns, attribute_columns or value_column, a Unexpected_Extra_Columns is reported according to the on_problems setting.