Skip to main content

Hello,

i've got this XML schema

and i want this

PRENOMNOMEMAILtest prenomtest nom

testemail.com

i've tried lots of thing s with XML flattener but nothing succeed.

can you help me

Thx

Hi @krowix,

First i created manually your XML:

On FME Desktop Workbench:

Add the Data XML and select Parameters:

Feature Paths Configuration => Elements to Match:

You can use the Inspector to chack this:

Thanks,

Danilo


Hi @krowix,

First i created manually your XML:

On FME Desktop Workbench:

Add the Data XML and select Parameters:

Feature Paths Configuration => Elements to Match:

You can use the Inspector to chack this:

Thanks,

Danilo

thanks @danilo_inovacao but i want to have id value into attribute and valeur value into feature...

 

 


Hello @krowix,

 

 

Once you have read in the XML, there are one of two methods you could carry out to pivot your attributes/values. The easiest, I think, will be to use the AttributeTransposer. This is a custom transformer that can be found on the FME Hub: https://hub.safe.com/transformers/attributetransposer

 

It will allow you to re-map the attributes and the value based on an existing attribute.

 

 

I've attached a sample workspace that will carry that out based on a subset of your XML preview.

 

xml-transpose.fmwt

I hope that helps.


Hi @krowix, alternatively, the XMLXQueryExtractor with the following XQuery expression and other parameters setting could work for you. Assuming the attribute "xml_fragment" of the input feature contains the XML fragment <Metier>.

XQuery Expression

for $x in //Metier/Donnee
return fme:set-attribute($x/Id/text(), $x/Valeur/text())

Other Parameters

0684Q00000ArKVZQA3.png


Hello @krowix,

 

 

Once you have read in the XML, there are one of two methods you could carry out to pivot your attributes/values. The easiest, I think, will be to use the AttributeTransposer. This is a custom transformer that can be found on the FME Hub: https://hub.safe.com/transformers/attributetransposer

 

It will allow you to re-map the attributes and the value based on an existing attribute.

 

 

I've attached a sample workspace that will carry that out based on a subset of your XML preview.

 

xml-transpose.fmwt

I hope that helps.

Hi @trentatsafe,

 

I downloaded this custom transformer and it is powerful. Thanks to share us this knowledge.

 

 

Thanks,

 

Danilo

 


Hello @krowix,

 

 

Once you have read in the XML, there are one of two methods you could carry out to pivot your attributes/values. The easiest, I think, will be to use the AttributeTransposer. This is a custom transformer that can be found on the FME Hub: https://hub.safe.com/transformers/attributetransposer

 

It will allow you to re-map the attributes and the value based on an existing attribute.

 

 

I've attached a sample workspace that will carry that out based on a subset of your XML preview.

 

xml-transpose.fmwt

I hope that helps.

Hi @trentatsafe,

 

 

i've tried your solution and it's work very well !

 

 

Thx for all

 

 


Thanks for all your help and comment !!!


There's also the FeatureBuilder custom transformer which will take a list of names and list of values and build records from them: https://hub.safe.com/transformers/featurebuilder

Don't forget for general info around reading and writing XML there is always the XML Tutorial: https://knowledge.safe.com/articles/29553/tutorial-getting-started-with-xml.html


Reply