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.

How to grep a child tag with all data associated as a single string Options · View
arcee123
Posted: Thursday, July 16, 2015 7:23:59 PM
Rank: Newbie

Joined: 7/16/2015
Posts: 2
Location: Louisiana
Greetings,
I am trying mapforce for the first time, and learning it's capabilities.

I have an xml that has a similar schema as this:

<root>
<child1>23</child1>
<child2>
<data1>test1</data1>
<data2>test2</data2>
</child2>
</root>

What I need to get is the XML snippet of <child2>.

I am using a CSV style output and want to have the following output
child1, child2
23,"<child2><data1>test1</data1></data2>test2</data2></child2>"

How do I get that via mapforce?

Thank you.
island
Posted: Friday, July 17, 2015 6:48:15 AM
Rank: Newbie

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

attached is an example maping and test files to achieve the desired results.

The contents of "test.xml" are mapped to another xml component which is set to "Serialize XML as Strings" The carriage return and line feed are then removed from the string and this is mapped to the output csv component.

File Attachment(s):
test.zip (3kb) downloaded 553 time(s).

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

arcee123
Posted: Saturday, July 18, 2015 12:14:52 AM
Rank: Newbie

Joined: 7/16/2015
Posts: 2
Location: Louisiana
Thank you so much.
the only trouble I am having is the option to "Change Root Node" is disabled/grayed-out.
How do I enable it so I can perform the changes?

THanks
vlad
Posted: Saturday, July 18, 2015 1:57:58 PM
Rank: Advanced Member

Joined: 12/13/2005
Posts: 2,856
Location: Mauritius
Are you talking about how to change from File to String? Click the File/String button...
island
Posted: Monday, July 20, 2015 8:20:26 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
arcee123 wrote:
Thank you so much.
the only trouble I am having is the option to "Change Root Node" is disabled/grayed-out.
How do I enable it so I can perform the changes?



The schema (xsd) used for the "intermediate component" in the mapping, defines "child2" as a global element (only elements defined globally in an xsd can be used as root elements in an instance xml file). If "child2" is not defined as a global element in your schema you will have to amend the xsd and declare it globally so that it can be used as a root element for the intermediate component in your mapping.
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.