2. Why is XML so difficult? XML is a language The language describes the data structures as well as the data content XML folks revel in complex data structures Hierarchical data structures GIS are usually based on relational data models FME & XML You tell FME how to interpret the XML data structures.
3. Reading XML Options for Reading XML with FME GML 3.2 & XSD Most GML can be interpreted if FME can use the XSD This will work if the OGC spec. is followed and internal feature constructs are not overly complex. Xfmap script for mapping XML structure to FME features Xquery W3C compliant Xquery Map XML tags to features or attributes using XQueryExploder & XQueryExtractor 3
5. Writing XML Options for Writing XML with FME GML standard formats FME supports a wide range of GML profiles (GML SF0, OS MasterMap, CityGML, etc.) GML 3.2 & XSLT Apply an XSLT (Extensible StylesheetLanguage Transformations) to the output Xquery W3C compliant Xquery Map FME features to XML templates using XMLTemplater transformer 5
8. Example: XML Object hierarchy Creating an electricsubstation XML: Coordinates and Attributes and contains Feeder(s) contain Attributes XML Document Substation Feeder A Feeder B
9. Example Sample XML: Source of XML templates Add Xquery: replace attribute values with Xquery statements Sample XML <substationobjectID="Vancouver Substation"> <mapLocation> <coord> <X>669170.169</X> <Y>1000199.534</Y> </coord> </mapLocation> <facilityID>5E67B377</facilityID> <sectionID>RPG123</sectionID> <phaseCode>ABC</phaseCode> <feederList> <feederObjectobjectID="8-64"> <feederName>10-24</feederName> <feederNo>8763</feederNo> <eaLoc>9D2D</eaLoc> </feederObject> <feederObjectobjectID="8-65"> <feederName>10-25</feederName> <feederNo>8766</feederNo> <eaLoc>9D3F</eaLoc> </feederObject> </feederList> <name>Vancouver Central</name> </substation> <feederObjectobjectID="{fme:get-attribute("objectID")}"> <feederName>{fme:get-attribute("feederName")}</feederName> <feederNo>{fme:get-attribute("feederNo")}</feederNo> <eaLoc>{fme:get-attribute("eaLoc")}</eaLoc> </feederObject>
10. XML Transformers Reading XQueryExploder Split XML documents into manageable “features” XQueryExtractor Extract attributes and other structures Writing XMLTemplator Convert FME attributes to XML Transformation XSLTProcessor 10
XML document CONTAINS a substation feature which CONTAINS several Feeder objects
Copy the XML template from an exiting sample of the XML replace the attribute values with XQuery statements repeat for other XML tags (i.e. substation)