On Wednesday 26 Oct 2005 10:30 pm IST, Andy Ross wrote:
AR> Kitts wrote:
AR> > I would like to know if there is any documentation on the XML file
AR> > format used within FlightGear.
AR> 
AR> First, note that the file format is used to generate a SGPropertyNode
AR> C++ object.  So the details of how that class should drive your
AR> understanding of the on-disk representation.

Thanks. I shall take a deeper look at class SGPropertyNode.

AR> > All the XML files in FlightGear seem to include <PropertyList> as
AR> > the first node. Is this node name mandatory or can the name be
AR> > anything else?
AR> 
AR> All XML files must have a top-level node.  This is the one used
AR> by a property file.  It is mandatory.

I understand that a root node is mandatory. I would like to know if the node 
name "PropertyList" is mandatory or a just a convention maintained for 
consistency.

AR> > This is the generated XML but how does one read the attributes
AR> > present within the angled brackets? I am referring to the
AR> > information such as "bar n="1" type="double"".
AR> 
AR> Property nodes have types, indicating what kind of data they store.
AR> This one is a "double", which corresponds to the built-in double
AR> precision floating poitn type.

Yes. But as i understand, the value of the leaf node may be read either with 
getDoubleValue or getFloatValue or getStringValue etc. How does one reading 
the node's value know what is the type so as to call the appropriate 
method? Unless this is an internal thing meant for the low level XML 
parser.

AR> Property nodes also have numeric "indices" to order properties of the
AR> same name (e.g. "/controls/engine/engines[2]/throttle").  Note that
AR> these are not strictly required to be contiguous, they can have any
AR> number you like.  But most code tends to assume a C-style array
AR> convention, where the first property has an index of zero.
AR> 
AR> If the index is left out, then the property is assigned to the next
AR> highest index available.  This is why the file you reference can leave
AR> out the n="0" index on the first <bar> nodes (although I'd argue that
AR> that's bad style -- either use implicit indices or explicit ones, but
AR> don't mix them).
-- 
Cheers!
Kitts


_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to