Skip to main content
Solved

Reading XML file output and extracting elements

  • November 24, 2017
  • 4 replies
  • 612 views

Forum|alt.badge.img

Hi,

Using FME desktop 17 I have a series of HTTPCallers containing GET and POST SOAP requests, however I cannot find either the suitable transformer or parameters to extract the fields required.

Attached sample XML file and parameter I need to extract and store are -

<report_id>

form_name

<report_date_time>

<report_uprn>

<report_usrn>

<report_status>

<questionnaires> (all que_key & que_ans fields)

 

Failed attempts using XMLFlattener & XMLFragmenter.

 

Cheers

Best answer by markatsafe

There's a tutorial on working with SOAP and FME here: Working with SOAP Services

You've already succeeded in using the HTTPCaller to get the SOAP response. The data you want is in the iData tag, which is an XML document imbedded in the SOAP response. So I think two XMLFlattener's should get you to the data you need. The first XMLFlattener to expose the contents of iData , the second XMLFlattener to flatten the attributes in the iData XML.

I've also attached the workspace: xmlflattener.fmwt

How to determine the Elements to Match parameter? The trick here is to use the XML reader. Open your XML document with the XML reader and use the tree view in Elements to Match to explore the XML and get the correct query. Copy that into the XMLFlattener Elements to Match parameter and the remove the XML reader.

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

4 replies

Forum|alt.badge.img+2
  • Best Answer
  • November 24, 2017

There's a tutorial on working with SOAP and FME here: Working with SOAP Services

You've already succeeded in using the HTTPCaller to get the SOAP response. The data you want is in the iData tag, which is an XML document imbedded in the SOAP response. So I think two XMLFlattener's should get you to the data you need. The first XMLFlattener to expose the contents of iData , the second XMLFlattener to flatten the attributes in the iData XML.

I've also attached the workspace: xmlflattener.fmwt

How to determine the Elements to Match parameter? The trick here is to use the XML reader. Open your XML document with the XML reader and use the tree view in Elements to Match to explore the XML and get the correct query. Copy that into the XMLFlattener Elements to Match parameter and the remove the XML reader.


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

Hi Mark,

Many thanks for your detail response and workspace.

As a novice this is invaluable, I'll be digesting your example today but thanks again.

Much appreciated.


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

Hi Mark,

Your solution has now enabled me to expose the XML elements required and being put to good use (thank you).

My next query with the same workspace is how to handle the same XML document should it contain multiple records (sample file attached) and process them in turn (the attributes will be used in additional sequential SOAP HTTPCallers)

Cheers

get-multiple-sbc-mcs-missed-bin-green-180.xml


takashi
Influencer
  • November 30, 2017
mdfwrestler wrote:

Hi Mark,

Your solution has now enabled me to expose the XML elements required and being put to good use (thank you).

My next query with the same workspace is how to handle the same XML document should it contain multiple records (sample file attached) and process them in turn (the attributes will be used in additional sequential SOAP HTTPCallers)

Cheers

get-multiple-sbc-mcs-missed-bin-green-180.xml

Try replacing the second XMLFlattener in Mark's workflow with an XMLFragmenter (Flatten Options: Enable Flattening).

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