Top FME Recipes: Cook’nup XML

1,065 views

Published on

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,065
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • 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)
  • Top FME Recipes: Cook’nup XML

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

    ×