Skip to main content
Solved

XML extraction

  • November 20, 2017
  • 8 replies
  • 16 views

Forum|alt.badge.img

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

Best answer by trentatsafe

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.

View original
Did this help you find an answer to your question?

8 replies

danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • November 20, 2017

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


Forum|alt.badge.img
  • Author
  • November 20, 2017
danilo_fme wrote:

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...

 

 


trentatsafe
Safer
Forum|alt.badge.img+6
  • Safer
  • Best Answer
  • November 20, 2017

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.


takashi
Influencer
  • November 21, 2017

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


danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • November 21, 2017
trentatsafe wrote:

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

 


Forum|alt.badge.img
  • Author
  • November 23, 2017
trentatsafe wrote:

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

 

 


Forum|alt.badge.img
  • Author
  • November 23, 2017

Thanks for all your help and comment !!!


deanatsafe
Safer
Forum|alt.badge.img+6
  • Safer
  • January 16, 2018

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings