Jon S Berndt wrote:
I've been wondering about easyXML, if it can be modified to support
validation against a DTD?
it probably can - if I remember correctly there are even some
suggestions for DTD's or rather SCHEMA's for FG around ??
Since it is built on top of eXpat - and I
believe eXpat _can_ be compiled to provide validation - is this just a
matter of proper compilation of the eXpat library?
I think the toplevel wrapper in easyxml is currently simply not
told to really care for any defined/existing DTD/SCHEMA ?
I ask because it is becoming clear to me that, as I compose the new
parsing logic for JSBSim config files - as well as the new config file
format itself - I may need to provide error checking / validation
functions as the data is read in. There are just too many opportunities
to mess up the config file.
A couple of days ago I talked exactly about something similar to
another FlightGear user: FlightGear happily starts up even if
there are XML errors in any of its files - this is not really
a problem for files that can be re-loaded, but particularly files
like menubar.xml can turn out to be a problem as soon as they
contain non-valid XML, simply because the actual 'validation'
or rather error-checking is done AFTER the GUI has started up -
and not as part of the initialization - so, you may very well
see FlightGear starting all its subsystems and then learn that
there's some bug in a config file such as menubar.xml - which would
ultimately mean that the menu is non-usable. :-/
It might make sense to think about optionally providing a
parameter to fgfs (for developers ?) to pre-parse/validate
the XML-based config files, so that fgfs would complain as
soon as it encounters anything invalid.
Ideally, this kind of thing would be done by
a config file editor, but since there is no config file editor on the
horizon, validation of a config file against a DTD becomes quite
*IF* you have a DTD/schema for your XML dialect it is no problem to
use any of the more advanced XML-editors and have it compare your
XML against the corresponding DTD/schema - so, there's no need
to really add it natively into FG or rather the parser if you
only want to have validation while you're editing a XML file.
IMHO, it simplifies parsing logic in the end application (in
this case, JSBSim).
it would probably make things easier, but as in most cases it would
firstly require a valid DTD/schema to be available for your
purpose - but then you should be able to use a validating
Now, this raises another question: do general purpose (or configurable)
XML application editors (open source or free, preferred) exist that
could be used to author a JSBSim config file?
I would have to look for open source/free linux tools, but I did use
such validating editors under windows - everything was presented in
some kind of treeview and it would complain if you use anything that
isn't explicitly mentioned in the DTD/schema.
Flightgear-devel mailing list