Command: xmlread

Syntax

xmlread <xmlfile>,<ident>

Description

Read an XML file into a Fire object.

Parameters

Switches

Notes

XML parsing is performed using the Xerces SAX parser.

XML comments, DTD and XSL specifications are ignored during parsing.

Data values may be loaded into structure members of the following types: string, numeric, point, time and blob. Appropriate data coercion will be done automatically.

When the destination object <ident> already exists, its member values will be updated by data from the xml file. However, the object is not zeroized first, and member array lengths will not be reset. It is therefore best practice to delete and recreate the object prior to this command.

Example

Read a schema-less xml file into a Fire object. First we must create a destination class.

# Define an appropriate Fire structure
    atable mytab
    structure ~mytab.poi_t,-tag='poi' {
        string name
        time date
        numeric id
        point location
    }
# Create an object of the type
    ~mytab.poit_t warmem
# Read xml file contents into it, the outer tag must be poi
    xmlread  warmem.xml,warmem

An example xml file for use with the above, named warmem.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<poi> <name>War Memorial</name> <date>18-Dec-1919</date> <id>6512</id> <location>(25466,71625)</location> </poi>

See Also

Commands:

blob, structure, xmlwrite, xsdread, xsdwrite

Functions:

xmlclass, xmltest

Structures:

.xml_tag