Solved

newbie trying XML Conversion to shape/CSV


Hi all,

I am trying to convert the Xml data to csv . For conversioni am using the Xml reader where in i have used feature path settings and one of the tag's from my Xml's and i have enable the flattening. it reading my Xml's but i am unable to extract the information from Xml's tags. Eg i want malaysia under column 1 likewise klang under colum 2:

icon

Best answer by mark2catsafe 11 July 2016, 17:49

View original

6 replies

Userlevel 4

I used the feature path MDSACTION and activated flattening. If you send the reader to the Data Inspector you will see:

So "Malaysia" is stored in the list item CREATEADDRESS.COMPONENT_SET.ADDRESSCOMPONENT{0}.TEXT, and "Klang" is stored in the list item CREATEADDRESS.COMPONENT_SET.ADDRESSCOMPONENT{1}.TEXT.

You can then use e.g. an AttributeRenamer to rename them to whatever you need for your output.

i have tried that earlier but it's not working ... and i am not been able to get the value as required . in this Xml's "1" is code for one of the attribute and it's value is stored in the text. Eg:- for 1 value is malaysia.

Do as David suggests and then use an AttributeCreator transformer.

In the parameters dialog, under the first column select "Attribute Value" and pick the TYPE part of the list. You'll be prompted to enter a list entry number. Choose 0. Then for the second column select the TEXT part of the list. Again enter 0 for the list number.

Now you will get an attribute called "1" with a value "Malaysia".

You'll have to repeat that for all other columns, increasing the list ID each time (or use a Custom Transformer with a loop).

I made a quick demo movie at: http://screencast.com/t/1RRYygWSvfR

Be sure to select "Attribute Value" for the first column (not "Select Attribute" as I did once in the movie)

Hope this helps

Mark

Do as David suggests and then use an AttributeCreator transformer.

In the parameters dialog, under the first column select "Attribute Value" and pick the TYPE part of the list. You'll be prompted to enter a list entry number. Choose 0. Then for the second column select the TEXT part of the list. Again enter 0 for the list number.

Now you will get an attribute called "1" with a value "Malaysia".

You'll have to repeat that for all other columns, increasing the list ID each time (or use a Custom Transformer with a loop).

I made a quick demo movie at: http://screencast.com/t/1RRYygWSvfR

Be sure to select "Attribute Value" for the first column (not "Select Attribute" as I did once in the movie)

Hope this helps

Mark

Quick note: if you try to route the output of this to the Data Inspector, there will be an error message. Instead you can use a Logger to prove the output is correct. I've filed a problem report with our developers to get that issue fixed (PR#71080)

Thank you @mark2catsafe and @david_r for the help.I have tried this with some changes and it worked .

Badge +3

you could also listexplode

CREATEADDRESS.COMPONENT_SET.ADDRESSCOMPONENT{}.

Reply