Download presentation
Presentation is loading. Please wait.
Published byBrett George Modified over 8 years ago
1
XML for Scientific Applications Marlon Pierce ERDC Tutorial August 16 2001
2
What is XML? Standard rule set for defining custom tags. –Make your (meta)data human-readable. –Separate data content from presentation (XSL). Rules for a particular dialect defined in either DTD or Schema. W3C: Standards Making Body –Same people that produced HTML. –See http://www.w3c.org
3
XML for E&M Input Data
4
Ex: XML for Electricity and Magnetism 2 Tags omitted for brevity balloon.dat ASCII P3D none …Tags omitted for brevity…
5
EX: E&M DTD Fragment Cut for brevity.
6
What the DTD Tells You What tags can be included Parent/child relationships The number of allowed tags of a particular type –1 only, 0 or 1, 0 or more, 1 or more. Names of attributes If the tag takes parsable character data
7
Ex: E&M Schema Fragment ….
8
Schema v. DTD (a partial list) Schemas are in XML; DTDs are not. Schemas have several simple types (integers, strings, floats, …); DTDs treat everything as character data. Schema complex types support inheritance –Bee complex type can be extended by drone, queen, worker subtypes. But DTDs have been around longer.
9
Now What? Get a parser for your favorite language –Apache XML Project’s Xerces parser supports Java, C++, Perl –http://xml.apache.orghttp://xml.apache.org Write code using the parser: –Validates XML files. –Returns the DOM. –You can now navigate the XML document tree
10
Document Object Model Defines general entities that make up the document. Forms a tree Objects include –Document –Node –Element –Attribute ProjectDesc GridDataMaterialList
11
Practical Drawbacks The DOM classes are very general. They only provide you with the most general way of navigating the tree. Typically for every XML dialect you create, you will have to write new code to extract the information. It would be nice if there was a better way to do this….
12
Automatic JavaBeans with Castor XML trees map nicely into Java Bean components. Get/Set methods return the information. Castor: automatically generates JavaBeans from XML and vice versa. You just write the Bean classes (simple) and Castor handles the mapping to XML. http://castor.exolabs.org
13
Some Standard XML Dialects Don’t reinvent what already exists. See http://www.w3c.org/TRwww.w3c.org/TR MathML ChemistryML SVG: Scalable Vector Graphics SOAP: Simple Object Access Protocol RDF: Resource Description Framework
14
Scientific Visualization with SVG
15
XML Namespaces Namespaces allow you to mix different types of XML. –You can combine custom and standard tags –Ex: combine GEMML plus MathML
16
Namespace Example
17
Additional References and Resources Inside XML by Steven Holzner. New Riders (2001). The W3C has a nice schema tutorial at www.w3.org/TR/xmlschema-0/ The ARL ICE project mixes XML and HDF5: www.arl.hpc.mil/ice/XdmfUser.htmlwww.arl.hpc.mil/ice/XdmfUser.html XSIL is a markup language for scientific data: www.cacr.caltech.edu/SDA/xsilwww.cacr.caltech.edu/SDA/xsil
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.