Hi,
i am new in CloverETL, so maybe my problem is no so complicated:
I am trying to read an xml like that:
<product id="59801">
<name>8J/7N - LE MANSOUR EDDAHBI 5*</name>
<productURL><![CDATA[http://vivacances.service-voyages.com/SAI00543482/sejour.htm]]></productURL>
<imageURL><![CDATA[http://vivacances.service-voyages.com/zi/promovac/82/SAI00543482A_pp.jpg]]></imageURL>
<price>489</price>
<description><![CDATA[
L'hôtel est situé au cour de Marrakech, à quelques minutes de la célèbre place Jemaa el Fna et des principaux monuments historiques de la ville.L'aéroport se trouve à 5 km. Taxis et navettes (payants).
]]></description>
<fields>
<field name="formule" Value="VOLS+HOTEL 5*+PETITS DEJEUNERS"/>
<field name="ville" Value="NANCY"/>
<field name="pays" Value="MAROC"/>
<field name="arrivee" Value="MARRAKECH"/>
<field name="duree" Value="7"/>
</fields>
<categories>
<category name="Voyage/Vacances"/>
</categories>
</product>
using:
<Metadata id="xmlToObject">
<Record name="output1" type="delimited">
<Field delimiter=";" locale="fr.FR" name="id" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="name" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="productURL" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="imageURL" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="price" nullable="true" type="numeric"/>
<Field delimiter=";" locale="fr.FR" name="description" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="formule" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="ville" nullable="true" type="integer"/>
<Field delimiter=";" locale="fr.FR" name="pays" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="arrivee" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="duree" nullable="true" type="numeric"/>
<Field delimiter="\r\n" locale="fr.FR" name="category" nullable="true" type="string"/>
</Record>
</Metadata>
but, surprise, i cannot read the fields "formule", "ville", "pays", "arrivee", "duree", ...
Any ideas??
Thanks!
i am new in CloverETL, so maybe my problem is no so complicated:
I am trying to read an xml like that:
<product id="59801">
<name>8J/7N - LE MANSOUR EDDAHBI 5*</name>
<productURL><![CDATA[http://vivacances.service-voyages.com/SAI00543482/sejour.htm]]></productURL>
<imageURL><![CDATA[http://vivacances.service-voyages.com/zi/promovac/82/SAI00543482A_pp.jpg]]></imageURL>
<price>489</price>
<description><![CDATA[
L'hôtel est situé au cour de Marrakech, à quelques minutes de la célèbre place Jemaa el Fna et des principaux monuments historiques de la ville.L'aéroport se trouve à 5 km. Taxis et navettes (payants).
]]></description>
<fields>
<field name="formule" Value="VOLS+HOTEL 5*+PETITS DEJEUNERS"/>
<field name="ville" Value="NANCY"/>
<field name="pays" Value="MAROC"/>
<field name="arrivee" Value="MARRAKECH"/>
<field name="duree" Value="7"/>
</fields>
<categories>
<category name="Voyage/Vacances"/>
</categories>
</product>
using:
<Metadata id="xmlToObject">
<Record name="output1" type="delimited">
<Field delimiter=";" locale="fr.FR" name="id" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="name" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="productURL" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="imageURL" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="price" nullable="true" type="numeric"/>
<Field delimiter=";" locale="fr.FR" name="description" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="formule" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="ville" nullable="true" type="integer"/>
<Field delimiter=";" locale="fr.FR" name="pays" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="arrivee" nullable="true" type="string"/>
<Field delimiter=";" locale="fr.FR" name="duree" nullable="true" type="numeric"/>
<Field delimiter="\r\n" locale="fr.FR" name="category" nullable="true" type="string"/>
</Record>
</Metadata>
but, surprise, i cannot read the fields "formule", "ville", "pays", "arrivee", "duree", ...
Any ideas??
Thanks!
-
Hi,
I'm afraid it is not possible from XMLExtract directly. You can transform your xml file by xslt (ie. name="ville" Value="NANCY" ->> ville="NANCY") and then you can use XMLExtract. There exists one more quite complicated solution. If you use something like
<Mappings>
<Mapping element="product" outPort="0" xmlFields="id" cloverFields="id">
<Mapping element="field" outPort="1" parentKey="id" generatedKey="id" xmlFields="name;Value" cloverFields="name;description"/>
</Mapping>
</Mappings>
you get list of records about one product and then you can use reformat component to aggregating products (java code in tranform method)... but last product. You get this one when sent some other record to reformat component after it.
Please sign in to leave a comment.
Comments 1