> No, there is no guarantee that the string will be non-empty (that goes
> down to the underlying XML library).  Again, make sure that you set
> value = "" at the start event, and then process value at the
> corresponding end event.
>
> David

OK, I think I've figured out what the mitigating circumstance is. I can avoid 
"digesting"
strings composed purely of blank spaces and newlines, but this seems to create 
a problem
with table constructs:

  <function NAME="aero/coefficient/Cnb">
      <description>Yaw moment due to beta</description>
      <product>
          <property>aero/qbar-psf</property>
          <property>metrics/Sw-sqft</property>
          <property>metrics/bw-ft</property>
          <table>
              <independentVar>aero/beta-rad</independentVar>
              <tableData>
                  -0.349  -0.0227
                   0.0     0.0
                   0.349   0.0227
              </tableData>
          </table>
      </product>
  </function>

I need each line of tableData to be read in and stored as a separate string. 
What fixes
the first problem I reported seems to cause a second, whereby the tableData 
stored ends up
looking like this:

  -0.349  -0.0227      0.0     0.0
   0.349   0.0227

That is, some of the lines are read in together. This is why it is so 
imperative for me to
understand the mechanics of how the data() function works and what can be 
passed in.

Here's what I have now for relevant parts of the functions:

startElement()
{
  working_string.erase();
}

endElement()
{
  if (!working_string.empty()) current_element->AddData(working_string);
  working_string.erase();
}

data()
{
  data_string = string(s, length);
  working_string += data_string;
}

Any suggestions?

Jon


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

Reply via email to