I try to import data from XML into Access but it doesn't fulfill my wishes. Consider this XML:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<countries xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocat
ion="city.
xsd">
<country>
<code>BR</code>
<name>Brasil</name>
<city>
<name>Brasilia</name>
</city>
<city>
<name>Manaus</name>
</city>
</country>
<country>
<code>JP</code>
<name>Japan</name>
<city>
<name>Osaka</name>
</city>
<city>
<name>Yokohama</name>
</city>
<city>
<name>Sapporo</name>
</city>
</country>
</countries>
I have created this xsd for it:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="
http://www.w3.org/2001/XMLSchema">
<xs:element name="countries">
<xs:complexType>
<xs:sequence>
<xs:element name="country" type="countryType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="countryType">
<xs:sequence>
<xs:element name="code" type="xs:string"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="city" type="cityType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="cityType">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Now if I import this into access it will give me a table of countries and a table of cities, but in the table of the cities there is no reference to a country found. Osaka will be in the city table, but there is no record to it's country Japan. This information is implicitly in the xml since the country "Japan" embraces the city "Osaka" but that is not enough to get a reference to Japan in the city table.
Can I get this job done someway by modifying the xsd?
Many thanks for any comment.
JP.
Start Free Trial