[GIS] Reading XML file in FME

fmexml

I want the below xml file to be read by fme.

I tried reading documents and seeing videos. This xml looks more complicated.

http://pastebin.com/pXmjwEqW

<InspectObjects>
<Object id="197589" action="update" objectType="pole" DataSetName="electric"     UniverseId="0" WorldId="0">
<Attributes>
<Attribute id="asset_id"></Attribute>
<Attribute id="id">197589</Attribute>
<Attribute id="location_description">A.T.L.</Attribute>
<Attribute id="npcl_ct">False</Attribute>

I have different objects in a single xml file. I want to filter based on "objectType".

How this can be done by using xml parsing in FME?

Best Answer

To extract the attributes you need the xmlflattener

"Flattens content of XML element(s) into feature attributes.

This transformer provides a quick and easy way to output any content or attributes of an XML element as feature attributes by specifying the element name or path. Optionally, the XML attributes from the ancestors of the specified elements can be fetched as FME attributes as well."

A good reference https://knowledge.safe.com/articles/Samples_and_Demos/Reading-Complex-XML-or-GML-using-the-XMLFlattener

Related Question