Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
veryimportantdude
Contributor III
Contributor III

Parsing XML

Hello,

i have an XML with products and each product has multiple subtags etc.

<product id="1">

  <idents>

   <ident type="sapid" value="1009913">1009913</ident>

   <ident type="partnumber" value="RBC6">RBC6</ident>

   <ident type="ean" value="731304003281">731304003281</ident>

  </idents>

  <base>

   <name>APC BatteryKit 1000I 1000INET BP SU SUA</name>

   <longname>APC BatteryKit 1000I 1000INET BP SU SUA</longname>

   <vendor value="80000572">APC</vendor>

   <categoryName value="I10002003">Diskovni sistemi in knjižnice / UPS / Baterije</categoryName>

   <category sequence="1">Diskovni sistemi in knjižnice</category>

   <category sequence="2">UPS</category>

   <category sequence="3">Baterije</category>

   <dimensions unit="MM" length="327" width="280" height="201">327 x 280 x 201 (MM)</dimensions>

   <weight unit="KG" value="8.208">8.208 KG</weight>

   <warranty unit="month" value="0">Brez garancije</warranty>

   <countryoforigin value="CN">China</countryoforigin>

   <commodity value="85078000">85078000</commodity>

   <url link="https://also.com/ec/cms5/5820/ProductDetailData.do?prodId=1009913" />

   <minorderqty uom="ea" value="1">1 kos</minorderqty>

  </base>

  <stock>

   <quantity uom="ea" status="1" value="1">1 kos</quantity>

   <backlogs>

    <backlog uom="ea" value="0" isotimestamp="2022 - 02 - 14T10:02: 40.004+00:00" unixtimestamp="1644832960" timezone="Europe/Ljubljana">20220225: Ni naročeno</backlog>

   </backlogs>

  </stock>

  <pictures>

   <picture sequence="0" view="Glavna slika" width="200" height="150" link="https://actebis-images.com/productimages/530fc204-60f3-41a8-9951-ba3f14d177d2.jpg">Glavna slika</picture>

   <picture sequence="1" view="Product shot Right-angle" width="400" height="300" link="http://cdn.cnetcontent.com/10/37/1037ab71-d709-4e3b-9b46-2d66eda464ab.jpg">Product shot Right-angle</picture>

   <picture sequence="2" view="Product shot Right-angle" width="200" height="150" link="http://cdn.cnetcontent.com/33/e9/33e9534a-7436-48af-be58-443cfe124f5f.jpg">Product shot Right-angle</picture>

   <picture sequence="3" view="Product shot Right-angle" width="640" height="480" link="http://cdn.cnetcontent.com/9c/e4/9ce4f526-8748-4a94-a959-857f8659405a.jpg">Product shot Right-angle</picture>

   <picture sequence="4" view="Product shot Right-angle" width="75" height="75" link="http://cdn.cnetcontent.com/f7/ab/f7ab1f4f-7b14-457d-a959-ead6c112b7c4.jpg">Product shot Right-angle</picture>

  </pictures>

  <attributes>

   <marketingtext lang="SL"></marketingtext>

   <specification lang="SL" name="Število baterij" value="1">1</specification>

   <specification lang="SL" name="Baterija" value="7">Lead-acid</specification>

   <specification lang="SL" name="Oblika baterije" value="9">Plug-in module</specification>

  </attributes>

 </product>

Now I need to put for example inside idents the first tag (sapid) into one field, ean into another.

<idents>

   <ident type="sapid" value="1009913">1009913</ident>

   <ident type="partnumber" value="RBC6">RBC6</ident>

   <ident type="ean" value="731304003281">731304003281</ident>

  </idents>

Same goes for eample for pictures.

sequence="0" has to go into one field sequence="1" into another etc.

I am kind of lost on how to specify the XMLs. Thank you

Best regard

Labels (3)
1 Solution

Accepted Solutions
veryimportantdude
Contributor III
Contributor III
Author

I solved the problem....

 

using extractXML field was needed due to large xml file anfterwards using this nottation the data was extracted

 

"./idents/ident[@type='partnumber']"

View solution in original post

5 Replies
Anonymous
Not applicable

Hello,

Could you please elaborate your case with an example with expected output values?

Best regards

Sabrina

veryimportantdude
Contributor III
Contributor III
Author

Sure

 

I will write where the filed should be mapped in a new xml

 

 <idents>

   <ident type="sapid" value="1009913">1009913</ident> --> <product id>

   <ident type="partnumber" value="RBC6">RBC6</ident> -- > <short_code>

   <ident type="ean" value="731304003281">731304003281</ident> -- > <ean code>

  </idents>

Also for pictures

 

<pictures>

   <picture sequence="0" view="Glavna slika" width="200" height="150" link="https://actebis-images.com/productimages/530fc204-60f3-41a8-9951-ba3f14d177d2.jpg">Glavna slika</picture>

   <picture sequence="1" view="Product shot Right-angle" width="400" height="300" link="http://cdn.cnetcontent.com/10/37/1037ab71-d709-4e3b-9b46-2d66eda464ab.jpg">Product shot Right-angle</picture>

   <picture sequence="2" view="Product shot Right-angle" width="200" height="150" link="http://cdn.cnetcontent.com/33/e9/33e9534a-7436-48af-be58-443cfe124f5f.jpg">Product shot Right-angle</picture>

   <picture sequence="3" view="Product shot Right-angle" width="640" height="480" link="http://cdn.cnetcontent.com/9c/e4/9ce4f526-8748-4a94-a959-857f8659405a.jpg">Product shot Right-angle</picture>

   <picture sequence="4" view="Product shot Right-angle" width="75" height="75" link="http://cdn.cnetcontent.com/f7/ab/f7ab1f4f-7b14-457d-a959-ead6c112b7c4.jpg">Product shot Right-angle</picture>

  </pictures>

 

new xml

 

<product>

<product id>1009913</product id>

<short_code>RBC6</short_code>

<ean code>731304003281</ean code>

<picture1>https://actebis-images.com/productimages/530fc204-60f3-41a8-9951-ba3f14d177d2.jpg</picture1>

<picture2>http://cdn.cnetcontent.com/10/37/1037ab71-d709-4e3b-9b46-2d66eda464ab.jpg</picture2>

<picture3>http://cdn.cnetcontent.com/10/37/1037ab71-d709-4e3b-9b46-2d66eda464xxxxxx.jpg</picture3>

</product>

 

Anonymous
Not applicable

@none yebach​ this looks like the same XML that we were talking about the other day. Sorry I missed this one. Have you achieved this yet? I think the values you are talking about are the same ones that we worked on. Once you have them out, you can build a new XML structure with a tXMLMap component.

veryimportantdude
Contributor III
Contributor III
Author

I solved the problem....

 

using extractXML field was needed due to large xml file anfterwards using this nottation the data was extracted

 

"./idents/ident[@type='partnumber']"

Anonymous
Not applicable

Hello,

Great you solved the problem and sharing the solution with us on community.

Best regards

Sabrina