This example shows how you can import records from an XML document.
With the following schema:
xml
table accounts
field acctno varchar accounts/account@acctno ''
field firstName varchar accounts/account/firstName ''
field lastName varchar accounts/account/lastName ''
field balance float accounts/account/balance 0
Importing the following XML document:
<?xml version="1.0" encoding="utf-8"?>
<accounts>
<account acctno="12345">
<firstName>John</firstName>
<lastName>Smith</lastName>
<balance>1532.43</balance>
</account>
<account acctno="67890">
<firstName>Jane</firstName>
<lastName>Doe</lastName>
<balance>1.32</balance>
</account>
<account acctno="13579">
<firstName>Mike</firstName>
<lastName>Schmidt</lastName>
</account>
</accounts>
Will get you a table like the following:
id acctno firstName lastName balance
------------+------------+------------+------------+------------+
4284d70513 12345 John Smith 1532.43
4284d70516 67890 Jane Doe 1.32
4284d70519 13579 Mike Schmidt 0
Note that because the balance wasn't present in the 3rd record, it took on the default value from the schema (0).