IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Map Excel Row and Col to XML Options · View
Georgi
Posted: Tuesday, October 16, 2018 1:50:23 PM
Rank: Newbie

Joined: 10/16/2018
Posts: 4
Hello, please, could anybody help me with this problem?

As a sorce file I have excel wtih defined are (e.g. C7:K28).
All cells I need map to XML structure like this:

<xs:element name="cell">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="row" use="required" type="ordNumType"/>
<xs:attribute name="col" use="required" type="xs:token"/>
<xs:attribute name="decimals" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="([-]?[1-9][0-9]{0,1})|[0]|(INF)"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>

I don't know, how can I map the row and col from source.
I will be thankfull for any advice.

Georgi

File Attachment(s):
example1.xlsx (12kb) downloaded 376 time(s).
example1.xml (2kb) downloaded 350 time(s).


island
Posted: Wednesday, October 17, 2018 4:00:04 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
HI,

please attach your Excel source file, your target xsd file(s) and the exact xml file that you wish to output from the given input Excel source data.

Georgi
Posted: Wednesday, October 17, 2018 7:16:33 AM
Rank: Newbie

Joined: 10/16/2018
Posts: 4
Here I'm sending attachments.

File Attachment(s):
example1.xlsx (12kb) downloaded 347 time(s).
example1.xml (2kb) downloaded 354 time(s).


island
Posted: Thursday, October 18, 2018 5:01:29 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
See attached mapping "test.mfd".

The mapping consists of two steps. The first step maps the excel source to an intermediate structure which outputs a file containing multiple "statPart" elements (see example_intermediate.xml).

The second step maps the intermediate structure to the ultimate target which generates only one "statPart" element as desired (see example_final.xml).

The intermediate component uses the "Duplicate Input" functionality to provide additional "cell" elements to map to.

Note the intermediate structure generates an output file in this mapping i.e. "example_intermediate.xml". This is simply to facilitate understanding of the example. Once you understand how it works you can replace the intermediate structure with a variable which does not generate an intermediate file (INSERT | Variable).

File Attachment(s):
test.zip (11kb) downloaded 354 time(s).

island attached the following image(s):
excel_xml.png
output.png

Georgi
Posted: Thursday, October 18, 2018 1:42:15 PM
Rank: Newbie

Joined: 10/16/2018
Posts: 4
Yes! It works!
Thanks a lot for help!

Best regards.
island
Posted: Thursday, October 18, 2018 3:50:38 PM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
Hi,

here is an even better variation without the need for an intermediate component.

File Attachment(s):
test2.mfd (13kb) downloaded 380 time(s).

island attached the following image(s):
excel_xml_2.png

island
Posted: Friday, October 19, 2018 4:05:57 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
and the third iteration is even better .....

File Attachment(s):
test3.mfd (7kb) downloaded 364 time(s).

island attached the following image(s):
excel_xml_3.png

Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.