Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

XML Mapping to multiple columns.

0

Hi. I am very new to this. The goal is to export data from Excel to an XML. I have built the schema file but I am running into the issue that I cannot map to more than one column. This is demographic data where there could potentiall be more than one phone number, email or address. I assume I need to edit something in the schema file, but I can't seem to figure it out. I thought it had something to do with the maxOccurs, but now I think I'm off base on that. 

Here is the excerpt from the schema:

<xs:element name="PhoneNumbers">

<xs:complexType>

<xs:sequence>

<xs:element name="PhoneNumber" minOccurs="1" maxOccurs="1">

<xs:complexType>

<xs:sequence>

<xs:element name="ExternalPhoneNumberID" minOccurs="1" maxOccurs="1">

<xs:simpleType>

<xs:restriction base="xs:integer">

<xs:minInclusive value="1"/>

<xs:maxInclusive value="2147483646"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element type="xs:integer" name="AreaCode" minOccurs="1" maxOccurs="1"/>

<xs:element type="xs:integer" name="Prefix" minOccurs="1" maxOccurs="1"/>

<xs:element type="xs:integer" name="Number" minOccurs="1" maxOccurs="1"/>

<xs:element type="xs:integer" name="Extension" minOccurs="0" maxOccurs="1"/>

<xs:element name="PhoneType" minOccurs="1" maxOccurs="1">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="Mobile"/>

<xs:enumeration value="Home"/>

<xs:enumeration value="Other"/>

<xs:enumeration value="Work"/>

<xs:enumeration value="Fax"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

And here is an example of how I need it to export:

<PhoneNumbers>

<PhoneNumber>

<ExternalPhoneNumberID>61</ExternalPhoneNumberID>

<PhoneType>Home</PhoneType>

<AreaCode>123</AreaCode>

<Prefix>456</Prefix>

<Number>7890</Number>

</PhoneNumber>

<PhoneNumber>

<ExternalPhoneNumberID>63</ExternalPhoneNumberID>

<PhoneType>Mobile</PhoneType>

<AreaCode>123</AreaCode>

<Prefix>567</Prefix>

<Number>8900</Number>

</PhoneNumber>

</PhoneNumbers>

Thank you in advance for all responses!

Answer
Discuss



Answer the Question

You must create an account to use the forum. Create an Account or Login