Andy Ross wrote:

I'd strongly suggest using the property tree parser.

Me too, simply because it's at least an order of magnitude easier. However, I suspect that Jon wants to use EasyXML for parsing the coefficients, and I have to admit that the property-tree format will be fairly verbose for modelling long tables. Assuming, then, that Jon ignores our advice, I'm attaching a few hints for using EasyXML.


EasyXML is what the XML community calls a "SAX-like" parser; the rest of the world would probably call it a fancy lexical analyzer. The parser reads a raw XML document and delivers a series of cooked parsing events to the client. For example, consider this document:

  <poem>
   <l>Roses are red,</l>
   <l>Violets are blue.</l>
  </poem>

A SAX-like parser will report the document to the application as a series of events something like these:

  startDocument()
  startElement("poem")
  data("\n ")
  startElement("l")
  data("Roses are red,")
  endElement("l")
  data("\n ")
  startElement("l")
  data("Violets are blue.")
  endElement("l")
  data("\n")
  endElement("poem")
  endDocument()

Note that the parser has no way of knowing what whitespace does and does not matter to your application, so it reports all of it. The application is reponsible for keeping track of the context, etc. etc.

Like SAX, EasyXML reports these events to the application through callbacks. You create a class extending XMLVisitor and overriding the methods for the events that you are interested in, then you pass an instance of that class to readXML() as an argument. EasyXML will invoke the appropriate methods to report the parsing events, and that's all, folks.


All the best,



David






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

Reply via email to