Download presentation
Presentation is loading. Please wait.
Published byJulius Young Modified over 9 years ago
1
Applications of XML Oz OceanAtlas Software and NOAA/PMEL
2
How I Use XML Settings files for JOA resources including preferences, color palettes, color bars, interpolation surfaces, map settings. As a replacement EPIC pointer files for describing collections of metadata for profile and time-series data. EPIC pointer files are difficult to parse with a rigid format that is difficult to expand.
3
Advantages of XML Not an opaque binary object (e.g., a serialized Java object)-- viewable and editable using very simple tools Settings files not rendered obsolete when your program needs change. If you serialized a Java object that held the specifications, for example, a map, changing the map specification object would render all your existing settings files unreadable. Using XML you would simple add/remove tags. Your code simply ignores obsolete tags until overwritten by a new version. Easy to organize information into hierarchies and a kind of object inheritance.
4
Advantages of XML (continued) Easy to parse with readily available libraries--I use an ancient SAX parser. Probably easier to parse with more modern libraries.
5
Examples: Setting File 1 8 4 2 yyyy-MMM-dd true 0
6
Examples: Setting File TEMP global 32 contours covering World Ocean ranges 32 -1.5 28.0 -1.5 -1.1 -0.9 -0.6 … 3.0 3.3 3.6 3.9 …
7
Designing XML Files I have usually designed my XML files by building a DTD (Document Type Definition) file (unless it’s very simple). DTDs describe “rules for how the XML document elements, attributes, and other data are defined and logically related in an XML-compliant document.” Can also use the DTD to validate the correctness of an XML document. An XML document may also have an associated stylesheet that specifies how the document looks when displayed (e.g., in a web browser). I don’t build stylesheets because I’m not concerned with how they look.
8
Example of a DTD: EPIC XML Pointer File <!ATTLIST epicxml version CDATA #REQUIRED type (profile | time-series | grid | other) #REQUIRED URI CDATA #IMPLIED lexicon CDATA #IMPLIED> <!ATTLIST time location (start | end | point) #REQUIRED “point” units CDATA #IMPLIED > <!ATTLIST date location (start | end | point) #REQUIRED “point” year CDATA #REQUIRED month CDATA #REQUIRED day CDATA #REQUIRED hour CDATA #IMPLIED min CDATA #IMPLIED secs CDATA #IMPLIED> <!ATTLIST latitude location (north | south | start | end | point) #REQUIRED “point” units (degrees_north | degrees_south) #IMPLIED “degrees_north”> <!ATTLIST longitude location (east | west | start | end | point) #REQUIRED “point” units (degrees_east | degrees_west) #IMPLIED “degrees_east”> <!ATTLIST vertical location (top | bottom | start | end | point) #REQUIRED “point” units CDATA #REQUIRED positive CDATA "down"> <!ATTLIST variable name ID #REQUIRED units CDATA #REQUIRED description CDATA #IMPLIED lexicon CDATA #IMPLIED> <!ATTLIST fileset id CDATA #REQUIRED URI CDATA #IMPLIED> <!-- time should have location=”start”, “end” for time series, “point” for profile, vertical should have location=”top”, “bottom” for profile, “point” for time series, latitude and longitude should have location=”point” --> <!ATTLIST station id CDATA #REQUIRED cast CDATA #IMPLIED URI CDATA #IMPLIED bottom CDATA #IMPLIED reference CDATA #REQUIRED> <!ATTLIST grid id CDATA #REQUIRED URI CDATA #IMPLIED reference CDATA #REQUIRED> <!ATTLIST track id CDATA #REQUIRED URI CDATA #IMPLIED reference CDATA #REQUIRED> <!ATTLIST stationvalue cast CDATA #REQUIRED name CDATA #REQUIRED units CDATA #REQUIRED method CDATA #IMPLIED lexicon CDATA #IMPLIED value CDATA #REQUIRED> <!ATTLIST attribute name CDATA #REQUIRED value CDATA #REQUIRED>
9
Example EPIC XML Pointer File from DTD -61.58 -38.166000000000004 116.84 129.633 0.0 5636.0 -58.745000000000005 117.138 3.0 4539.0 -56.055 117.22 10.0 4529.0 -52.951 117.043 12.0 2319.0 -51.198 116.921 10.0 2614.0 -49.083 117.24000000000001 5.0 3130.0 -47.478 116.84 8.0 3686.0 -46.068 117.031 8.0 3589.0 -43.026 117.123 5.0 4353.0 -39.138 117.046 7.0 4461.0 -61.58 120.146 2.0 4249.0 -57.94 120.128 1.0 4687.0 -56.053000000000004 119.941 1.0 4557.0 -55.068 119.793 1.0 4608.0 -54.016 119.791 1.0 4078.0 -53.043 119.71600000000001 4.0 3520.0 -51.99 119.505 1.0 3611.0 -50.028 119.66 1.0 3375.0 -48.021 120.063 1.0 3741.0 -46.061 119.89 1.0 4255.0 -56.778 129.633 102.0 4570.0 -56.026 128.148 9.0 4626.0 -53.176 128.181 13.0 4072.0 -52.056000000000004 128.121 14.0 2656.0 -50.588 128.006 8.0 2769.0 -48.973 128.187 10.0 3768.0 -47.623 128.073 8.0 3774.0 -47.505 128.006 9.0 1361.0 -45.15 128.013 12.0 5683.0 -43.336 129.451 4.0 4499.0 -42.01 127.973 9.0 4923.0 -38.166000000000004 128.058 5.0 5658.0 A dummy comment for testing XML Writing
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.