I received a sample ready-made GML file (60 MB) along with a corresponding XSD file, with the aim of converting some of my databases to an identical GML form. I first opened this GML in the FME Data Inspector, from where I converted it to File Geodb, with the intention of converting it from File Geodb back to GML. However, instead of gml:FeatureCollection, original GML uses abc:FeatureCollection, and all features are not in abc:FeatureCollection, but in a child element abc:FeatureCollectionMembers, like this:

<abc:FeatureCollection gml:id="abc_FeatureCollection" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://www.abc.com/gml/abc abc.xsd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:abc="http://www.abc.com/gml/abc" xmlns:gml="http://www.opengis.net/gml/3.2">
      <gml:lowerCorner>#######.## #######.##</gml:lowerCorner>
      <gml:upperCorner>#######.## #######.##</gml:upperCorner>
    <abc:Type>Type of Data</abc:Type>
    <abc:FeatureClass1 gml:id="LOCAL_ID_1">
    <abc:FeatureClass2 gml:id="LOCAL_ID_2">
    <abc:FeatureClassN gml:id="LOCAL_ID_N">

How can I achieve this in FME Workbench?

  • Could you perhaps write the data out using FME's GML transformers, and then take the output file, and run it through a text reader, then use the replace string transformer to replace the gml:FeatureCollection, with abc:FeatureCollection? Commented Aug 14, 2022 at 22:44
  • That may be an option (if the generated GML is not too big for a text editor), but my bigger problem is abc:FeatureCollectionMembers and I would like to solve it in an automated way. Commented Aug 14, 2022 at 22:53
  • Another option could be to use the PythonCaller and generate a list of the abc:FeatureCollectionMembers. Once you have the list, then create your gml using a text editor. Potentially in the AttributeCreator, then save that attribute as a text file with a gml extension. Commented Aug 14, 2022 at 22:59
  • Just to clarify, I do not mean use a text editor like Notepad++ to do the find and replace, I mean using the FME readers and string transformers to do the replace from within FME - still keeping the "automated" component of the workbench. Commented Aug 14, 2022 at 23:02

1 Answer 1


Here is a simplistic example of changing the values in the GML as you explained it. You mentioned that you have converted the template GML to FileGDB and then converted the FileGDB back to GML.

I will assume that this component of the workbench works. I will also assume that you have used the FeatureWriter Transformer.

Once you have saved the GML, use the FeatureReader Transformer to read in the GML you created in the FeatureWriter. You will see in the "Summary" from the FeatureWriter a field called "_dataset", this field contains the data you have just written. Drag this Summary into the FeatureReader:

enter image description here

Select the Format as Text File and the dataset, use the dropdown box next to the input box and select "Attribute Value" and then the "_dataset" attribute.

This will read in your GML as a string, in the "Text_Line" attribute. You can then use the StringReplacer transformer to replace the "gml:FeatureCollectionMembers" to "abc:FeatureCollectionMembers". You may need to link one or more of these StringReplacers together to make sure you get all the strings replaced.

enter image description here

For my example, I changed "gml:featureMember" to "abcl:featureMember" and "ogr:" to "xyx:" in my GML.

enter image description here

You will also need to run a parallel process and rename the "*.xsd" to the name of the name of the gml you have created. For example, my text writer spat out:

testing_gml_edits.gml, so the associated original xsd needs to be renamed to testing_gml_edits.xsd

Here is a snap of the original GML:

enter image description here

Here is the revised GML:

enter image description here

The Points plot on top of each other:

enter image description here

So this should help with your issue.

Just some key points:

  1. Read the data in as text
  2. Ensure the output TextWriter has the file extension - you have to stipulate the *.gml and *.xsd file formats in the output path.
  • Thanks for taking the time to research this, Allan. This is a really interesting approach. I tried to solve this task in one reader-writer session and I have not used the FeatureWriter transformer but OGC GML Writer. I'll give it i try and I'll let you know. Commented Aug 15, 2022 at 7:30
  • Hello Allan, I tried to get the result using the given schema, but that way I don't get the geometry, because apparently the namespace abc: from the XSD file replaces some elements from the gml: namespace. When I use OGC GML Writer without the XSD file (GML 3.2.1) I get the geometry, but the elements are badly formatted and they don't match the schema from the file. Obviously, I should have asked first if it were possible to get the geometry from that XSD file with a custom namespace. Your approach opened the door to some new ideas for me, so I'll consider your post answered. Thanks again. Commented Aug 16, 2022 at 22:30
  • One more thing... There is no something like gml:FeatureCollectionMembers to replace it with abc:FeatureCollectionMembers. <abc:FeatureCollectionMembers> behave like FeatureCollection inside FeatureCollection <abc:FeatureCollection>. I have to create it and insert it inside <abc:FeatureCollection> or read it from <abc:FeatureCollection> table and convert it to an element and then insert it. Commented Aug 18, 2022 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.