Norman Vine writes:

 > If you are comfortable with Python
 > 
 > You can define your objects in Python 
 > and then dump their XML representation :-)
 > 
 > 
 >http://www-106.ibm.com/developerworks/xml/library/x-matters15.html?open&l=810,t=grx,p=rpc

There is similar code for Java, but I've never been happy with it -- a
serialized Java object in XML is still a serialized Java object, and
has little value for someone using C++, Perl, or Python; you might as
well just serialize into a native format (perhaps Python's native
serialization format is XML-based, but the point still holds).

A useful XML spec is one that abstracts out the implementation
differences among various programming languages and applications, so
that it can be used in ways not originally planned.  For example, this
is useful and usable by many apps (and human-readable):

  <airport id="CYOW">
   <name>MacDonald-Cartier International Airport</name>
   <icao-airport-code>CYOW</icao-airport-code>
   <iso-country-code>CA</iso-country-code>
   <position>
    <lat-deg>45.318783</lat-deg>
    <lon-deg>-075.669678</lon-deg>
    <elev-ft>374</elev-ft>
   </position>
  </airport>

but something like this (which I made up but is typical), much less so:

  <java:object id="obj12345">
   <java:class>com.megginson.apt.Airport</java:class>
   <java:data>
    <java:member>
     <java:name>name</java:name>
     <java:object-ref ref="#obj54321"/>
    </java:member>
    <java:member>
     <java:name>icaoAirportCode</java:name>
     <java:object-ref ref="#obj65432"/>
    </java:member>
    <java:member>
     <java:name>isoCountryCode</java:name>
     <java:object-ref ref="#obj76543"/>
    </java:member>
    <java:member>
     <java:name>position</java:name>
     <java:object-ref ref="#obj87654"/>
    </java:member>
   </java:data>

   <!-- and then repeat for each referenced object -->


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to