FME and XML

The majority of web services will return a payload in either XML or JSON and which is returned is a function of the web service, its age and the technology that is delivering the service. Often a web service will return the information in either format.

However JSON is the most dominant format for web services and you can see from the diagram below showing Google Search trends that XML's popularity in the last 5 years or so has dropped off.

Google Search Trends: Blue = JSON and Red = XML

XML is typically found on older web services or those proprietary interfaces from larger software vendors with significant legacy investment. Similarly the Open GeoSpatial Consortium's web services such as WMS or WFS have until recently relied on XML.

The reason that XML's use has declined is that it is difficult to work with, verbose and suffers from performance issues in comparison to JSON. For this reason most modern web services use or offer JSON this includes spatial services providing GeoJSON rather than GML.

FME has always maintained strong support for XML and has support for many XML based data formats so it retains a rich toolset to work with those web services that use XML.

Reviewing the XML transformers you will see that many of them replicate the JSON transformers already discussed and will perform the same function as their JSON counterpart. The more complex nature of XML means there are a number of more specialist transformers as well for using the XQuery language and XSLT when processing XML.

XML Transformers within FME:

You'll notice the presence of the JSONTemplater transformer and this is because its underlying operations are driven by the XML processor in FME, so it shares some of its functionality.

XML Templates:

We have seen how you can use templates within FME when we looked at handling JSON responses. The same processes can be used with XML data as well.

This example shown allows the user to create Inspire compliant metadata using an ISO19115 based template within a workflow, and having created the metadata record it is then possible to send this to an Inspire compliant metadata registry using the OGC Catalogue Service for Web (CSW) web service. This allowed the user to keep their metadata in sync when they update their data on Open Data or Inspire portals.

Metadata Record:

Workflow for keeping creating the metadata and posting it to the CSW web service.


Further Information:

Using XML in FME is the subject of a training course in itself and FME has a lot of advanced capabilities for handling XML data. Working with XML in FME is the same whether it has come from a web service or not.

If you want more information on using XML in FME the following are good introductions.

Using XML within FME

Working with the XMLTemplater