Question

Best practice for reading xml with multiple occurrences

  • 27 January 2014
  • 2 replies
  • 5 views

Badge
Hi All, 

 

 

I read data from online services, typically as XML. Untill now I've been a quite happy user of httpFetcher to download data and then xmlflattener or xmlfragmenter to digest them. This has worked pretty well for simple XML problems, but there are obvious limitations.

 

 

I've cast my eyes on the xfMap documentation, in particular this piece of information: 

 

http://docs.safe.com/fme/html/FME_ReadersWriters/Default.htm#xml/attribute_element_multipleValues.htm 

 

 

This seem to be exactly what I'm ready for to mature my crude XMLfragment-and-assemble (hardcoded for each particular application) into beautiful, generic methods. However, the more sophisticated use of xfMap seems to be tied to the "XML Reader" (which is just FME speak for "Insert Reader", then choose XML as format. Or is it?). 

 

 

The caveat: FME  typically read things as the very first thing you do in a workspace.

 

I, on the other hand, do quite a bit of processing to dynamically compose the links before downloading anything (give me param1=A&param2=B etc).

 

 

Of course I can put the "Reader" in a different workspace and use workspace runner to start it (feeding it (the link to) the data), but this seems a rather brutal way to solve the problem. Surely, there must be a better way... I am sure I am overlooking something - but what??? 

 

 

What are my options for reading XML with my own xfMap-definitions? Preferably as a set of transformers within my workspace... 

 

 

 

 

 

 

 


2 replies

Userlevel 4
Badge +13
Hi,

 

 

You can use the XMLFeatureMapper with a number of configurations for xfmap, on an attribute containing your downloaded  XML data.

 

 

Itay
Badge
XMLFeatureMapper is exactly what I was looking for, thanks a lot. :) 

 

 

I was absolutely 100% certain FME would have this functionality, but somehow I failed to spot the xmlfeaturemapper. 

 

Reply