Post · 7 min read· pp. 419–424

An XML Airfoil Geometry Format

Contents

Purpose of XML-Files

The *eXtensible Markup Language* format (XML) is being used by many programs for almost all kind of data handling. In contrast to several other file formats, its main advantages are

  • well defined language for general data storage and retrieval,
  • possibility to store hierarchically structured data,
  • not a complex binary format, but ASCII based, and
  • by using stylesheet transformations (XSLT) an XML file can be transformed into any other ASCII format almost without any programming work.

I have defined an XML schema to represent the geometry of airfoils, which can be used to describe the geometry of single and multi element airfoil sections. It would be very helpful, if such a format would be implemented by most programs which handle airfoil coordinates. Life could be much easier, if there would be no need for conversion tools like my Concord program.

Structure of an XML-File

Any  XML file is made up from tags similar to a HTML file. Tags are enclosed in pointed parentheses (). Each XML file must begin with a header tag:

```text
|

Tags must occur in pairs - opening and closing tags must be paired. In
contrast to HTML the names of the remaining tags are not prescribed, but can be
defined by the user. To be useful for data transfer, the names of the tags must
be known to and data receiver. Therefore an XML scheme can be set up, which
describes the tag names and their content.

## <a id="XMLSchema"></a>The XML-Schema

As tags can be nested, it is possible to create an object oriented 
representation of structured data quite well. For example an airfoil coordinate
point consists of two items, namely the <x> and the <y> values. An airfoil shape
in turn is made up of several coordinate points and a multi element airfoil may
be composed of several airfoil shapes.

My XML airfoil schema is named "airfoil-schema" of course and is stored in an
XML file "[airfoil-schema.xsd](https://www.mh-aerotools.de/airfoils/xml-schemas/airfoil-schema.xsd)". It
describes the types of elements and their allowed contents. For example the
coordinate values for "x" and "y" are declared to be of type "float" and each
"point" consists at least of one "x" and "y" pair. A complete structured
description of the schema and all its elements
[can be found here](/u/42c6d6eff8fd175e).

## Defining an XML-File based on the Airfoil-Schema

Now the schema looks quite complicated, but you shouldn't be too much
impressed. The graph below shows a compact view of the structure described by
the schema. The airfoil XML file packages the data items that make up the
geometry at different levels. If we were only interested in the number of
elements of a multi element airfoil, we don't have to dive down to the x-y
coordinates, but descend only down to the <elements> collection and count its
children (named <element>)

![](https://cdn.archive.preserve.ng/img/cacd4e2928cd788ceb490c359d0891aa3b607c2aa8a3f4e4d08d603dd511755d.gif)

The example below should shed more light on the structure of an airfoil-XML
file. As the XML file is nicely and hierarchically structured, it is relatively
easy to write a very simple XML parser for these airfoil files. On the other
hand professionally written parsers are available for many languages, including
Java, C++, Fortran. Under MS-Windows the Microsoft COM component MSXML can be
used with almost all languages. Before you start to write your own parser, I
would highly recommend to examine the available parsers. These can handle
unexpected conditions, a wild variety of formatting styles (indenting, line
breaks) and often have the capability to validate a file against the schema.
Thus you can validate a file before actually delving into its data tree to make
sure that all required elements are there and contain valid data.

Writing an xml file is much easier, because you know what goes into the file
and there are no unknowns.

## <a id="XMLExample"></a>Example 1: A simple XML Airfoil-File

|  |
| --- |
| ```text
<?xml version="1.0" encoding="ISO-8859-1"?>
<airfoil xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xmlns="http://www.mh-aerotools.de/airfoil-schema" 
         xsi:schemaLocation="http://www.mh-aerotools.de/airfoils/xml-schemas/airfoil-schema airfoil-schema.xsd">
```  ```text
 <!-- the previous lines describe the location of the schema document which defines the
      default "name space". These are used for validating the contents of the file.
      First the prefix "xsi" is defined to refer the elements defined in the
      "http://www.w3.org/2001/XMLSchema-instance" schema. This standard schema is usually
      embedded in all parsers, so no location must be given.
      Then the default namespace is defined to be "http://www.mh-aerotools.de/airfoil-schema".
      Finally the string assigned to "xsi:schemaLocation" links this namespace to the file
      "airfoil-schema.xsd". This is a location where the parser can find the schema
      description file. If it is in a different directory as the airfoil file, it would
      maybe read "./schemas/airfoil-schema.xsd".
      It could also be an URL like "http://www.mh-aerotools.de/airfoils/xml-schemas/airfoil-schema.xsd"
      if you prefer to access the document via the internet.
      --> 
```  ```text
<name>MH 20</name>

<elements>
  <element>

    <transformation>
      <scaling>
        <point><x>1.0</x><y>1.0</y><z>1.0</z></point>
      </scaling>
      <translation>
        <point><x>0.0</x><y>0.0</y><z>0.0</z></point>
      </translation>
      <rotation>
        <point><x>0.0</x><y>0.0</y><z>0.0</z></point>
      </rotation>
    </transformation>

    <coordinates>
      <point><x>1.0000000</x><y>0.0000000</y><z>0.000</z></point>
      <point><x>0.9974300</x><y>-0.0000100</y><z>0.000</z></point>
      <point><x>0.9897699</x><y>0.0000700</y><z>0.000</z></point>
      <point><x>0.9770700</x><y>0.0005000</y><z>0.000</z></point>
      <point><x>0.9594799</x><y>0.0014100</y><z>0.000</z></point>
```  ```text
... a few points omitted (x-y-coordinates are mandatory, z can be omitted)
```  ```text
      <point><x>0.9770700</x><y>-0.0025500</y><z>0.000</z></point>
      <point><x>0.9897699</x><y>-0.0010600</y><z>0.000</z></point>
      <point><x>0.9974300</x><y>-0.0002400</y><z>0.000</z></point>
      <point><x>1.0000000</x><y>-0.0000400</y><z>0.000</z></point>
    </coordinates>
  </element>
</elements>

</airfoil>
``` |

Remarks:

1. Indentation is not required, but allowed. It has been added to show the
   structure more clearly.
2. The z-coordinates can be omitted as they are usually equal to zero.
3. The translation block can be omitted. In this case a scaling of 1.0 and no
   translation as well as no rotation is assumed (as in the transformation shown)
4. Coordinates should be arranged so that they circle around the section in a
   mathematically positive sense. This means counter clockwise when looking from
   +z onto the in the x-y plane. Nevertheless, reader programs should check and
   if necessary reverse the order to their internal requirements.
5. The transformation is performed in this order (sequence is important!)
   1. scaling in x-, y-, and z-directions,
   2. rotation around the z-, y-, and x-axis,
   3. translation.
6. You can use the *[Concord](/u/91d696fa9b77ddc4)* program to convert coordinates into this XML standard format.

## Example 2: Transformations for a two element airfoil:

![](https://cdn.archive.preserve.ng/img/25930fac63bff256562184be8eae3639cb19fe6c4df92e41acd982d9ec5a359d.gif)

|  |  |
| --- | --- |
| Main Element, standard transformation | Flap element, scaled, rotated and translated |
| ```text
<transformation>
 <scaling>
   <point><x>1.0</x><y>1.0</y></point>
 </scaling>
 <translation>
   <point><x>0.0</x><y>0.0</y></point>
 </translation>
 <rotation>
   <point><x>0.0</x><y>0.0</y><z>0.0</z></point>
 </rotation>
 </transformation>
``` | ```text
<transformation>
 <scaling>
   <point><x>0.30</x><y>0.30</y></point>
 </scaling>
 <translation>
   <point><x>0.95</x><y>-0.05</y></point>
 </translation>
 <rotation>
   <point><x>0.0</x><y>0.0</y><z>-25.0</z></point>
 </rotation>
 </transformation>
``` |

*Last modification of this page:
21.05.18*

![](https://cdn.archive.preserve.ng/img/a0fb51ae0a565bc876ef035a30a85824ff204f638c6544441d3f8ef1310a2f9a.jpg)

[[Back to Home
Page](https://www.mh-aerotools.de/airfoils/index.htm)] **Suggestions? Corrections? Remarks? e-mail:
[Martin Hepperle](javascript:asfdrg(zzyzz())).**

It might take some time until you receive an answer
and in some cases you may even receive no answer at all. I apologize for this, but
my spare time is limited. If you have not lost patience, you might want to send
me a copy of your e-mail after a month or so.*This is a privately owned, non-profit page* of purely educational purpose.
Any statements may be incorrect and unsuitable for practical usage. I cannot take
any responsibility for actions you perform based on data, assumptions, calculations
etc. taken from this web page.

*© 1996-2018 Martin Hepperle
You may use the data given in this document for your personal use. If you use this
document for a publication, you have to cite the source. A publication of a recompilation
of the given material is not allowed, if the resulting product is sold for more
than the production costs.*