You can import application data from an XML file provided that the XML elements conform to the diagram format.
As an example, Code Sample 5.1 shows the initial XML data file for the genealogy tree as loaded in Getting Started.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE diagram>
<diagram metadata="true" xmlns:sdm="http://www.ilog.com/JViews/SDM/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<person id="person_1">
<property name="sex">male</property>
<property name="sdm:y">264.91016</property>
<property name="firstname">John</property>
<property name="profession">teacher</property>
<property name="deathdate">1960</property>
<property name="sdm:x">35.429688</property>
<property name="name">Smith</property>
<property name="birthdate">1900</property>
</person>
<person id="person_2">
<property name="sex">female</property>
<property name="sdm:y">165.28516</property>
<property name="firstname">Janet</property>
<property name="deathdate">1970</property>
<property name="sdm:x">35.429688</property>
<property name="name">Whoop</property>
<property name="birthdate">1903</property>
</person>
<couple id="couple_1">
<property name="startdate">1920</property>
<property name="sdm:y">215.09766</property>
<property name="sdm:x">123.75</property>
<property name="status">married</property>
</couple>
<couplelink islink="true" id="couple_11" from="person_1" to="couple_1" />
<couplelink islink="true" id="couple_21" from="person_2" to="couple_1" />
<person id="person_3">
<property name="sex">male</property>
<property name="sdm:y">310.3828</property>
<property name="firstname">Andrew</property>
<property name="profession">engineer</property>
<property name="deathdate">1995</property>
<property name="sdm:x">214.79688</property>
<property name="name">Smith</property>
<property name="birthdate">1922</property>
</person>
<childlink islink="true" id="child_1_3" from="couple_1" to="person_3" />
<person id="person_4">
<property name="sex">female</property>
<property name="sdm:y">119.8125</property>
<property name="firstname">Mary</property>
<property name="profession">Advocat</property>
<property name="sdm:x">214.79688</property>
<property name="name">Smith</property>
<property name="birthdate">1924</property>
</person>
|
<childlink islink="true" id="child_1_4" from="couple_1" to="person_4" />
<person id="person_5">
<property name="sex">male</property>
<property name="sdm:y">212.97656</property>
<property name="firstname">Richard</property>
<property name="profession">Writer</property>
<property name="deathdate">1995</property>
<property name="sdm:x">214.79688</property>
<property name="name">Bilbot</property>
<property name="birthdate">1920</property>
</person>
<couple id="couple_2">
<property name="startdate">1942</property>
<property name="sdm:y">166.39453</property>
<property name="enddate">1960</property>
<property name="sdm:x">305.84375</property>
<property name="status">divorsed</property>
</couple>
<couplelink islink="true" id="couple_42" from="person_4" to="couple_2" />
<couplelink islink="true" id="couple_52" from="person_5" to="couple_2" />
<person id="person_6">
<property name="sex">male</property>
<property name="sdm:y">166.39453</property>
<property name="firstname">Henry</property>
<property name="profession">Driver</property>
<property name="sdm:x">391.375</property>
<property name="name">Bilbot</property>
<property name="birthdate">1945</property>
</person>
<childlink islink="true" id="child_2_6" from="couple_2" to="person_6" />
<person id="person_7">
<property name="sex">male</property>
<property name="sdm:y">26.648438</property>
<property name="firstname">Jack</property>
<property name="profession">Technician</property>
<property name="deathdate">1997</property>
<property name="sdm:x">214.79688</property>
<property name="name">Johnson</property>
<property name="birthdate">1925</property>
</person>
<couple id="couple_3">
<property name="startdate">1960</property>
<property name="sdm:y">73.23047</property>
<property name="sdm:x">305.84375</property>
<property name="status">married</property>
</couple>
<couplelink islink="true" id="couple_43" from="person_4" to="couple_3" />
<couplelink islink="true" id="couple_73" from="person_7" to="couple_3" />
</diagram>
|
Code Sample 5.1 Simple Genealogy Tree Data and Model in XML
In this XML file:
-
A link is a top-level XML element (
childlink or couplelink) with the attribute isLink set to true and attributes from and to which refer to nodes defined in the same file.
-
All other top-level XML elements are treated as nodes (
person and couple).
-
Properties are defined as children of a node or link element. Each property has a value.
-
The
sdm:x and sdm:y properties are x- and y-coordinates giving the location of a node.