Using fromXml() to store an xml string. If the string is empty and the string tags are not used i.e.
<value></value>
The call to XmlRpcUtil::getNextTag gets the value end tag and the fromXml() method returns "false".
David
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I forgot to mention before - thank you for a nicely implemented library.
This bug was quite nasty in my example as the empty string was in a struct in an array in a struct. The whole lot gets marked invalid type. I did a quick hack on the fromXml() as follows:
In the check for typeTag:
else if (typeTag.empty() || typeTag == VALUE_ETAG || typeTag == STRING_TAG)
result = stringFromXml(valueXml, offset);
And at the bottom of the fn:
if (result && typeTag != VALUE_ETAG) // Skip over the </value> tag
{
XmlRpcUtil::findTag(VALUE_ETAG, valueXml, offset);
}
else if(!result)
{
*offset = savedOffset;
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think that might still fail for cases where the string is not empty, but is blank (all whitespace). How about this:
if ( ! XmlRpcUtil::nextTagIs(VALUE_TAG, valueXml, offset))
return false; // Not a value, offset not updated
int afterValueOffset = *offset;
std::string typeTag = XmlRpcUtil::getNextTag(valueXml, offset);
bool result = false;
if (typeTag == BOOLEAN_TAG)
...
// Watch for empty/blank strings with no <string>tag
else if (typeTag == VALUE_ETAG)
{
*offset = afterValueOffset; // back up & try again
result = stringFromXml(valueXml, offset);
}
I have made this change and a couple others locally and will get them into cvs tonight.
Chris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using fromXml() to store an xml string. If the string is empty and the string tags are not used i.e.
<value></value>
The call to XmlRpcUtil::getNextTag gets the value end tag and the fromXml() method returns "false".
David
Yup. I'll fix that. For now, use the <string> tags if you can.
I forgot to mention before - thank you for a nicely implemented library.
This bug was quite nasty in my example as the empty string was in a struct in an array in a struct. The whole lot gets marked invalid type. I did a quick hack on the fromXml() as follows:
In the check for typeTag:
else if (typeTag.empty() || typeTag == VALUE_ETAG || typeTag == STRING_TAG)
result = stringFromXml(valueXml, offset);
And at the bottom of the fn:
if (result && typeTag != VALUE_ETAG) // Skip over the </value> tag
{
XmlRpcUtil::findTag(VALUE_ETAG, valueXml, offset);
}
else if(!result)
{
*offset = savedOffset;
}
I think that might still fail for cases where the string is not empty, but is blank (all whitespace). How about this:
if ( ! XmlRpcUtil::nextTagIs(VALUE_TAG, valueXml, offset))
return false; // Not a value, offset not updated
int afterValueOffset = *offset;
std::string typeTag = XmlRpcUtil::getNextTag(valueXml, offset);
bool result = false;
if (typeTag == BOOLEAN_TAG)
...
// Watch for empty/blank strings with no <string>tag
else if (typeTag == VALUE_ETAG)
{
*offset = afterValueOffset; // back up & try again
result = stringFromXml(valueXml, offset);
}
I have made this change and a couple others locally and will get them into cvs tonight.
Chris