Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I convert this type of Excel XLS sheet into proper XML?
    primarykey
    data
    text
    <p>I'm trying to setup a Schema file for use with Excel XML Mapping. What I want to accomplish is to take each row in my spreadsheet, and have it output XML like this:</p> <p>Excel Rows:</p> <pre><code>XML_Name | Initiative | HitPoints ad_wasp 5 42 hob_goblin 7 22 </code></pre> <p>Desired XML Output:</p> <pre><code>&lt;entities&gt; &lt;ad_wasp&gt; &lt;initiative&gt;5&lt;/initiative&gt; &lt;hitpoints&gt;42&lt;/hitpoints&gt; &lt;/ad_wasp&gt; &lt;hob_gob&gt; &lt;initiative&gt;7&lt;/initiative&gt; &lt;hitpoints&gt;22&lt;/hitpoints&gt; &lt;/hob_gob&gt; &lt;/entities&gt; </code></pre> <p>In other words - I want to make the first row in my Excel sheet a main element tag, and then under that, put the following rows in as sub-elements. I want it in this format as a program I'm working with (Fantasy Grounds 2) accepts modular addons in XML format, and needs uniquely named elements like this, enclosing sub-elements.</p> <p>Keep in mind - I'm totally new to XML. Maybe I can't do this. What I've been able to pick up in the last 3 hours is ...</p> <ol> <li>In Excel, click into the Developer tab.</li> <li>Define an XML Map Source</li> <li>Point it to the XSD</li> </ol> <p>I've created a schema file as you can see below using XMLSpy - BUT, the problem I'm having is that the schema below puts everything in tags like this:</p> <pre><code>&lt;xml_tag&gt; &lt;Name&gt;aasimar&lt;/Name&gt; &lt;XP&gt;Aasimar&lt;/XP&gt; &lt;CR&gt;Aasimar&lt;/CR&gt; &lt;Init&gt;Aasimar&lt;/Init&gt; &lt;/xml_tag&gt; </code></pre> <p>Is there a way to do what I want? If I try to put a "type="xs:string"" declaration into the "XML_Tag" element, I get an error (The 'type' attribute and an anonymous type definition are mutually exclusive for element declaration 'xml_tag'.) However - I don't know how to make the element a "dynamic variable" (probably the wrong jargon to use), as opposed to the same, static tag.</p> <pre><code>&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"&gt; &lt;xs:element name="Entities"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="xml_tag" form="unqualified" nillable="true" minOccurs="0" maxOccurs="unbounded"&gt; &lt;xs:complexType&gt; &lt;xs:sequence minOccurs="0"&gt; &lt;xs:element name="Name" type="xs:string" form="unqualified" nillable="true" minOccurs="0"/&gt; &lt;xs:element name="XP" type="xs:integer" form="unqualified" nillable="true" minOccurs="0"/&gt; &lt;xs:element name="CR" type="xs:integer" form="unqualified" nillable="true" minOccurs="0"/&gt; &lt;xs:element name="Init" type="xs:integer" form="unqualified" nillable="true" minOccurs="0"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload