Hi,

inspired by the XML Schema delivered with JSBSim, I started to write on for 
YASim (and I have in mind to create one for the other config files, too).

First, for those who do not know what the hack is a XML schema and what do I 
need it for?

A schema is some kind of a formal description of the structure a xml-file 
should/could/must have. There are parsers, that can validate a xml-file 
against a schema file and tell you, if your creation is valid or not and what 
is wrong with it. 
Sounds boring, but: it is very interesting, if you use a schema capable 
xml-editor (vi and notepad are not, sorry). With the help of the xml-schema 
you can edit xml-files with all the goodies you know from modern IDE, like 
detecting syntax errors while you type, drop-down lists of valid choises of 
elements, context-help items and so on. It prevent you from putting things 
into wrong places e.g. if you try to put a <piston-engine> under a <wing> 
element or assign a "capacity" attribute to a <gear> element.
It also does some nice "pretty-printing", indenting, auto-closing tags etc. 
etc.

My favorite editor is XMLSpy, but that is my personal view.

To build the schema, I merged the README.yasim and the information I got from 
the YASim-sourcecode from cvs. Almost all documentation in the schema is 
copy-and-pasted from the README.yasim.

Here are some screenshots while working on a file using XMLSpy:
(sorry, the mouse-pointer and the text-carret are not visible)

http://www.t3r.de/fg/XMLSchema/XMLSchema1.jpg
This is while hovering the cursor over the "chord" attribute of a <wing> 
element, while the caret is on the "incidence" attribute. You see the balloon 
help for the "chord" attribute in yellow and the description of the 
"incidence" attribute in the lower right corner. In the upper right, you see 
the "model" of the <wing> element, what attributes are allowed and what 
elements may be contained.

http://www.t3r.de/fg/XMLSchema/XMLSchema2.jpg
This one shows a complaint about a type in the "compression" attribute of a 
<gear> element. I typed "zero comma one" instead of the correct "zero point 
one".  Compression is defined as a float-value (see upper right corner) so a 
comma is invalid.

http://www.t3r.de/fg/XMLSchema/XMLSchema3.jpg
Here I add an element to the <cruise> tag. After typing the opening <, a 
dropdownlist with the valid elements appear together with a short help for 
the tag.

http://www.t3r.de/fg/XMLSchema/XMLSchema4.jpg
I selected the <solve-weight> tag and because "idx" and "weight" are declared 
as "mandatory, they automatically appear in the editor. The tag is still 
marked bad, because the values of the attributes are invalid.

This is just a little teaser, not a complete howto about editing xml files, so 
I stop here. 

The schema is downloadable here:
http://www.t3r.de/fg/XMLSchema/YASim.xsd

a documentation of the schema is here (boring mashine-generated stuff):
http://www.t3r.de/fg/XMLSchema/docs/YASim/YASim.xsd.html

and a tarball of the schema with the documentation is here:
http://www.t3r.de/fg/XMLSchema/YASim-schema-0.1.tar.gz

Thanks for reading this long post.

Torsten


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to