How to Read XSD-Driven XML

Kailin Opaleychuk
Kailin Opaleychuk
  • Updated

FME Version

  • FME 2022.0


This Tutorial demonstrates how to read a FIXM document using FME’s XSD-Driven XML Reader. FIXM stands for Flight Information Exchange Model. FIXM is a global standard model for integrating flight information and typically uses FIXM XML schemas. Here, we use FME Workbench to translate our FIXM document into an Esri File Geodatabase.

Reading Feature Paths Vs. Reading XSD Types as Features

Both feature paths and XSD types as features can be used to map features in FME Desktop. The approach you adopt may even be a combination! – similar to the example shown later in this tutorial, where we read a sample FIXM dataset. It should also be noted, when both are used; feature paths take precedence over XSD types as features. 

When we specify an XSD type as a feature, this means all elements declared as that type will be mapped as feature types in FME. Therefore, any element declarations in the XSD that match or extend the selected type definition(s) will be identified by this parameter as a feature.

However, specifying a feature path is specifying a path from the root to the element, or simply – the element itself. Elements selected here will be converted into FME feature types.

Ultimately, reading XSD types as features should be utilized when there is a hierarchical-type schema present. When a hierarchical-type schema is present, it simplifies the process by potentially reducing the number of entries required for reading. This is because all elements declared by a type are identified at once, instead of the individual elements themselves. However, for this to work optimally, an in-depth understanding of your schema is required.



XSD-Driven XML Validation determines whether the reader/writer should validate the XML document against the XSD schema. For more on Validation please see the Validation section, here.


Step-by-step Instructions

To follow along with this exercise from home, please download the contents in the Files section of this article. In this scenario, we convert an XSD-Driven XML document into an Esri File Geodatabase.

1. Create a New Workspace
Open FME Workbench on your machine, and start a new workspace.

2. Add an XSD-Driven XML Reader
Use the Add Reader button to add an XSD-Driven XML Reader to the canvas. Set your source dataset to “fixm v1 ex1.xml”, which can be found in the Files section mentioned above.

In the parameters, click on the ellipsis next to Application Schema and navigate to the …\fixm11-master\msg\src\msg.xsd dataset. 

Then click on the ellipsis next to Feature Paths, and expand msg:FlightMessage. Select both of the following paths:

  • msg:FlightMessage/msg:flight 
  • msg:FlightMessage/msg:flight/fx:activeFlightPlan


Once the Feature Paths have been set, click on the ellipsis next to XSD and select:

Finally, set Validate Dataset to Yes, then click OK twice to finish adding the reader. 

3. Select Feature Types
In the Select Feature Type dialog, select the following as Feature Types: activeFlightPlan, flight, and location. Click OK to add them to the canvas.

4. Inspect the Data
With Run with Feature Caching enabled, click run to cache the data. Use the Visual Preview window to inspect the FIXM flight and activeFlightPlan reader feature types. Notice that the flight table is the parent for activeFlightPlan. 

5. Add a FeatureMerger
Merge the parent (flight) and child (activeFlightPlan) Feature Types using a FeatureMerger transformer. Connect flight to the Supplier port, and activeFlightPlan to the Requestor port. 

In the parameters, under the Join On section, we are going to set xml_parent_id as the Requestor to join xml_id as the Supplier in an Automatic Comparison Mode. Next, set Merge Feature Type to Attributes Only, as we have no geometry in our dataset right now. Expand Attribute Accumulation, then set the Accumulation Mode to Prefix and set the Prefix to Flight_ 

6. Merge Location
Now, we are going to merge another XML child (location) feature type onto our previously merged XML data. Duplicate the FeatureMerger, by selecting it and on your keyboard using (ctrl+d or cmd+d). In this merge, the child (location) will be the Requestor. The Supplier will be the results from the previous FeatureMerger, specifically the output of the Merged port. Note that the Requestor input port was moved down to clean up the lines. This is done by right-clicking on the port and selecting Move Down. 

In the FeatureMerger_2 parameters, since we duplicated the previous FeatureMerger, we only need to change the Prefix. Change the Prefix to ActiveFlightPlan_  

7. Create Point Data
Add a VertexCreator to your workspace and connect it to the Merged output port from the FeatureMerger_2. In the parameters, change the Mode to Add Point, then set the X Value to base_long and the Y Value to base_lat.  

8. Assign a Coordinate System
Use a CoordinateSystemSetter to assign a coordinate system to your features. Open the parameters and select LL84.

9. Add an AttributeKeeper
Before writing to File Geodatabase, we should remove unnecessary or empty attributes. To do this, add an AttributeKeeper to the canvas and connect it to the CoordinateSystemSetter. 

In the parameters, use the Filter bar to find the attribute to keep:

  • ActiveFlightPlan_Flight_gufi
  • ActiveFlightPlan_fx_flightPlanIdentifier
  • ActiveFlightPlan_xml_id
  • ActiveFlightPlan_xml_parent_id
  • ActiveFlightPlan_xml_parent_property
  • base_lat
  • base_long
  • base_srsName
  • xml_id
  • xml_parent_id
  • xml_parent_property

You can also copy and paste in the following comma-delimited list to save time:


10. Add another AttributeKeeper.
Add a second AttributeKeeper to the canvas and connect it to the CoordinateSystemSetter. In the parameters select the following attributes to keep. Note when using the Filter search, use the words before the periods, then expand the options: 

  • ActiveFlightPlan_departure.estimatedDepartureTime
  • ActiveFlightPlan_enRoute.alternateAerodromeRoute.text
  • ActiveFlightPlan_filing.accepted
  • ActiveFlightPlan_flightType
  • ActiveFlightPlan_request.airspeed
  • ActiveFlightPlan_request.airspeed.base_uom
  • ActiveFlightPlan_request.flightRules
  • xml_id
  • xml_parent_id
  • xml_parent_property

Again, to save time, you can copy and paste in the following list:


11. Add a File Geodatabase Writer.
Add an Esri Geodatabase (File Geodb Open API) writer to the canvas. Browse to a folder to save the dataset and name it FIXM_EX.gdb. Ensure that the Feature Clase Definition is set to Copy from Reader and click OK. 

In the Select Feature Type dialog, select the flight and location feature types and then click OK. 

Connect the location writer feature type to the AttributeKeeper and the flight writer feature type to the AttributeKeeper_2. 


12. Change Feature Type Geometry.
Open the location writer feature type parameters and change the Geometry to geodb_point. 

Then open the flight writer feature type parameters, change the Geometry to geodb_point, then switch to the User Attributes tab. Change the Attribute Definition to Automatic to use only the attributes selected in the AttributeKeeper. 

13. Run your workspace.
Run the workspace, and inspect the output using either Visual Preview or Esri ArcGIS. 

Your results should look similar to the below document. You will notice our flight path crosses the International Date Line and is visually segmented into two parts, though the results are accurate. 



Data Attribution

Data in this article originated from a Github repository and was made available by FIXM , managed by the US Department of Transportation.

Was this article helpful?



Please sign in to leave a comment.