How to import XML child structures to Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.my-Company.com/keygen"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Keygen">
<xs:annotation>
<xs:documentation>A listing of options and the various views and modules
that they contain</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Option" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="OptionNumber" minOccurs="0"/>
<xs:element name="OptionName" minOccurs="0"/>
<xs:element name="View" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Module" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

and the following data:

<Keygen xmlns="http://www.my-Company.com/keygen"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.my-Company.com/keygen
Keygen2.xsd">
<Option>
<OptionNumber>1</OptionNumber>
<OptionName>One</OptionName>
<View>View 1</View>
<View>View 2</View>
</Option>
<Option>
<OptionNumber>2</OptionNumber>
<OptionName>Two</OptionName>
<View>View 3</View>
<View>View 4</View>
<View>View 5</View>
<Module>Module 1</Module>
<Module>Module 2</Module>
</Option>
</Keygen>

If I import this into Access (2003) it creates two records - ignoring the
child structure. If I import it into Excel (2003) it creates 8. In production
I will have more records that excel can handle.

Any suggestions as to how to get Access to recognise this child structure?
 
When Importing you have the option to Transform the XML.
I have seen it done once but am no XML expert so...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top