XML Mapping in Excel 2013

2

I have a spreadsheet where on each line I register a test case and then export it to XML, and then upload this xml to another system we use.

The problem is that I can only do 1 to 1, I can not fill several rows and then export all, when I do this the XML exports only the first row and nothing else or gives an error that I can not handle.

Currently exporting this way:

    <testcases>
<testcase internalid="980" name="Caso de testes Importação">
   <node_order><![CDATA[100]]></node_order>
   <externalid><![CDATA[1]]></externalid>
   <version><![CDATA[1]]></version>
   <summary><![CDATA[<p>&nbsp;O caso de teste deve fazer isso   </p>]]></summary>
   <preconditions><![CDATA[<p>&nbsp;<a id="fck_paste_padding"></a>&nbsp;Pré Condições od caso de testes</p>]]></preconditions>
   <execution_type><![CDATA[1]]></execution_type>
   <importance><![CDATA[2]]></importance>
<steps>
<step>
   <step_number><![CDATA[1]]></step_number>
   <actions><![CDATA[<p>&nbsp;A1</p>]]></actions>
   <expectedresults><![CDATA[<p>&nbsp;EXC1</p>]]></expectedresults>
   <execution_type><![CDATA[1]]></execution_type>
</step>

<step>
   <step_number><![CDATA[2]]></step_number>
   <actions><![CDATA[<p>&nbsp;A2</p>]]></actions>
   <expectedresults><![CDATA[<p>&nbsp;EXC2</p>]]></expectedresults>
   <execution_type><![CDATA[2]]></execution_type>
</step>
</steps>
</testcase>
</testcases>

But I need to export it this way:

<testcases>
   <!-- Aqui começa o caso de teste 1 --> 
<testcase internalid="980" name="Caso de testes Importação">
   <node_order><![CDATA[100]]></node_order>
   <externalid><![CDATA[1]]></externalid>
   <version><![CDATA[1]]></version>
   <summary><![CDATA[<p>&nbsp;O caso de teste deve fazer isso   </p>]]></summary>
   <preconditions><![CDATA[<p>&nbsp;<a id="fck_paste_padding"></a>&nbsp;Pré Condições od caso de testes</p>]]></preconditions>
   <execution_type><![CDATA[1]]></execution_type>
   <importance><![CDATA[2]]></importance>
<steps>
<step>
   <step_number><![CDATA[1]]></step_number>
   <actions><![CDATA[<p>&nbsp;A1</p>]]></actions>
   <expectedresults><![CDATA[<p>&nbsp;EXC1</p>]]></expectedresults>
   <execution_type><![CDATA[1]]></execution_type>
</step>

<step>
   <step_number><![CDATA[2]]></step_number>
   <actions><![CDATA[<p>&nbsp;A2</p>]]></actions>
   <expectedresults><![CDATA[<p>&nbsp;EXC2</p>]]></expectedresults>
   <execution_type><![CDATA[2]]></execution_type>
</step>
</steps>
</testcase>

   <!-- Aqui Termina o caso de teste 1 --> 



      <!-- Aqui começa o caso de teste 2 --> 
<testcase internalid="981" name="Caso de testes Importação">
   <node_order><![CDATA[100]]></node_order>
   <externalid><![CDATA[2]]></externalid>
   <version><![CDATA[1]]></version>
   <summary><![CDATA[<p>&nbsp;O caso de teste deve fazer isso   </p>]]></summary>
   <preconditions><![CDATA[<p>&nbsp;<a id="fck_paste_padding"></a>&nbsp;Pré Condições od caso de testes</p>]]></preconditions>
   <execution_type><![CDATA[1]]></execution_type>
   <importance><![CDATA[2]]></importance>
<steps>
<step>
   <step_number><![CDATA[1]]></step_number>
   <actions><![CDATA[<p>&nbsp;A1</p>]]></actions>
   <expectedresults><![CDATA[<p>&nbsp;EXC1</p>]]></expectedresults>
   <execution_type><![CDATA[1]]></execution_type>
</step>

<step>
   <step_number><![CDATA[2]]></step_number>
   <actions><![CDATA[<p>&nbsp;A2</p>]]></actions>
   <expectedresults><![CDATA[<p>&nbsp;EXC2</p>]]></expectedresults>
   <execution_type><![CDATA[2]]></execution_type>
</step>
</steps>
</testcase>

   <!-- Aqui Termina o caso de teste 2 --> 

</testcases>

Spreadsheetstructure:

    
asked by anonymous 24.10.2016 / 20:13

1 answer

2

Good morning!

As far as I know and I worked with XML in Excel, there are two files one works with two XML files, one containing the data (.xml) and another containing the schemas (.xsd).

I do not know how your XML map in Excel can be viewed via the Developer > Source Code (XML) , however, some parameters that Excel understands as repeated data are <xsd:sequence> (all together).

Here is an example of a working scheme for exporting multiple data:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="Cadastro">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element minOccurs="0" maxOccurs="unbounded" name="Pessoa">
          <xsd:complexType>
            <xsd:all>
              <xsd:element minOccurs="0" maxOccurs="1" name="Nome" type="xsd:string"/>
              <xsd:element minOccurs="0" maxOccurs="1" name="Nascimento" type="xsd:date"/>
              <xsd:element minOccurs="0" maxOccurs="1" name="Telefone" />
              <xsd:element minOccurs="0" maxOccurs="1" name="Calc" />
              <xsd:element minOccurs="0" maxOccurs="1" name="Test" type="xsd:integer"/>
            </xsd:all>
          </xsd:complexType>
        </xsd:element>        
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

To test, here's a step-by-step guide:

  • Save this code above in a document with extension .xsd (eg com_map.xsd )

  • Open Excel, on the Developer tab, click Source, in the XML option, click XML Maps and add the saved XML map >), as below:

  • After viewing the map, select all the items and paste them in the spreadsheet, as shown below:
  • Enter some data and export in XML via the Developer tab > Export (XML)
  • All data, including all filled rows, will be in your XML.

    I hope I have helped.

    [EDITION 1]

    If you have your XML ready, an example of what you need, with multiple lines, you can try importing the file (.xml) into Excel, which will automatically generate the map for you.

    Then try changing the data, inserting new rows and exporting, this should also work, but you will not have the map (.xsd) designed to edit some information (header) or data type that needs to be exported in XML

        
    25.10.2016 / 12:16