XDMF Model and Format
XML
The eXtensible Markup Language (XML) format is widely used for many purposes and is well documented at many sites. There are numerous open source parsers available for XML. The XDMF API takes advantage of the libxml2 parser to provide the necessary functionality. Without going into too much detail, XDMF views XML as a "personalized HTML" with some special rules. It it case sensative and is made of three major components : elements, entities, and processing information. In XDMF were primarily concerned with the elements. These elements follow the basic form :
<ElementTag
AttributeName="AttribteValue"
AttributeName="AttributeValue"
.. >
CData
</ElementTag>
Each element begins with an <tag> and ends with a </tag>. Optionally there can be several "Name=Value" pairs which convey additional information. Between the <tag> and the </tag> there can be other <tag></tag> pairs and/or character data (CData). CData is typically where the values are stored; like the actual text in an HTML document. The XML parser in the XDMF API parses the XML file and builds an tree structure in memory to describe its contents. This tree can be queried, modified, and then "serialized" back into XML.
Comment in XML start with a <!-- and end with a -->.� So <!--This is a Comment -->.
XML is said to be well formed if it is syntactically correct. This is all of the quotes match, all elements have end elements, etc. XML is said to be valid if it conforms to the Schema or DTD defined at the head of the document. For example, the schema might specify that element type A can contain element B but not element C. Verifying that the provided XML is well formed and/or valid are functions typically performed by the XML parser. Additionally XDMF takes advantage of two major extensions to XML :
XInclude
As opposed to entity references in XML(which is a basic substitution mechanism), XInclude allows for the inclusion of files that are not well formed XML. This means that with XInclude the included file could be well formed XML or perhaps a flat text file of values. The syntax looks like this :
<Xdmf Version="2.0" xmlns:xi="<a href="http://www.w3.org/2001/XInclude">http://www.w3.org/2001/XInclude</a>">
<xi:include href="Example3.xmf"/>
</Xdmf>
the xmlns:xi establishes a namespace xi. Then anywhere within the Xdmf element, xi:include will pull in the URL.
XPath
This allows for elements in the XML document and the API to reference specific elements in a document. For example :
The first Grid in the first Domain
/Xdmf/Domain/Grid
The tenth Grid .... XPath is one based.
/Xdmf/Domain/Grid[10]
The first grid with an attribute Name which has a value of Copper Plate
/Xdmf/Domain/Grid[@Name=Copper Plate]
All valid XDMF must appear between the <Xdmf> and the </Xdmf>. So a minimal (empty) XDMF XML file would be :
<?xml version="1.0" ?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
<Xdmf Version=2.0>
</Xdmf>
While there exists an Xdmf DTD and a Schema they are only necessary for validating parsers. For performance reasons, validation is typically disabled.
XDMF Elements