I've encountered an unexpected problem with the class I have derived from EasyXML. In one of the configuration files I have, the following lines are present:

            <function NAME="aero/coefficient/Cndr">
                <description>Yaw moment due to rudder</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/bw-ft</property>
                    <property>fcs/rudder-pos-rad</property>
                    <value>-0.043</value>
                </product>
            </function>

When I parse this construct I find that the last tagged property does not get parsed correctly. What happens as the program is actually run shows this:

DATA LINE: ***=>fcs/rudde<=***
      Parsing property name: fcs/rudde
FGPropertyManager::GetNode() No node found for fcs/rudde

You can see that the "fcs/rudder-pos-rad" property name is only partially read. If I go back and look at the overridden data() function in my XMLVisitor-derived class, I see that I did this:

void FGXMLParse::data (const char * s, int length)
{
  const char *local_string = s;
  data_string = local_string;
  data_string.resize(length);
  if (data_string.find_first_of(VALID_CHARS) != string::npos)
    current_element->AddData(data_string);
}

I know it's not pretty and certainly better approaches are solicited from readers. Reading the documentation in the props.hxx file I see this:

   * Note that character data may be chunked arbitrarily: the
   * character data content of an element may be returned in one
   * large chunk or several consecutive smaller chunks.

So, I guess I've been lucky so far that the data I have gotten - except in this particular case - has been chunked together. I'm a little stumped as to how I can make sure that I get all the data for an element and store it as an STL string for later reading.

Suggestions?

Jon

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

Reply via email to