Cláudio Ribeiro
Cláudio Ribeiro

Reputation: 1699

XSD mapping in Excel to generate multiples instances of XML elements

i'm using an XSD mapping in conjunction with excel in which i can insert information in order to generate an XML file. The problem is, the XSD mapping i'm using doesn't let me create multiple instances of an element. Here's my XSD code:

<?xml version="1.0" encoding="ISO-8859-1"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="application">
    <xs:complexType>
        <xs:all>
            <xs:element name="name" type="xs:string" />
            <xs:element name="pagina">
                <xs:complexType>
                    <xs:all>
                        <xs:element name="page_name" type="xs:string" />
                        <xs:element name="formulario" minOccurs="0">
                            <xs:complexType>
                                <xs:all>
                                    <xs:element name="textField" type="xs:string" minOccurs="0" />
                                    <xs:element name="checkBox">
                                        <xs:complexType>
                                            <xs:all>
                                                <xs:element name="opcao" type="xs:boolean" minOccurs="0" />
                                            </xs:all>
                                        </xs:complexType>
                                    </xs:element>
                                </xs:all>
                            </xs:complexType>
                        </xs:element>

                        <xs:element name="listagem" minOccurs="0">
                            <xs:complexType>
                                <xs:all>
                                    <xs:element name="entrada" minOccurs="1" type="xs:string" />
                                </xs:all>   
                            </xs:complexType>
                        </xs:element>
                    </xs:all>
                </xs:complexType>
            </xs:element>

            <xs:element name="escolha" minOccurs="0">
                <xs:complexType>
                    <xs:all>
                        <xs:element name="origem" type="xs:string" /> 
                        <xs:element name="onSuccess" type="xs:string" />
                        <xs:element name="onFailure" type="xs:string" />
                    </xs:all>
                </xs:complexType>
            </xs:element>

        </xs:all>
    </xs:complexType>
</xs:element>

For example, when i create the map in excel i can only create a single entry of information for "entrada", when in reality i would like to be able to add multiple entries of information of "entrada" for a single "listagem" element.

How can i map the information so i can achieve this?

Upvotes: 0

Views: 4269

Answers (1)

Matt Whipple
Matt Whipple

Reputation: 7134

By default maxOccurs and minOccurs will default to 1, allowing for only a single element. You need to set maxOccurs to unbounded or an explicit value.

<xs:element name="entrada" minOccurs="1" maxOccurs="unbounded" type="xs:string" />

Upvotes: 1

Related Questions