Menu

xml struct with empty field issue?

Help
frmano
2008-01-11
2013-04-24
  • frmano

    frmano - 2008-01-11

    Hi,
    I have a server set with XmlRpc++ on WinXP and it works perfectly, except for one exception. When the client sends a struct inside the xml with one of the fields having an empty value (as in <name>name</name><value><string/><value/>), the server is unable to retrieve the other fields of the struct inside the XmlRpcValue - if I test it with params.hasMember(), it returns false, even though they were on the xml sent. Is this a known bug, is there a way to make this work?
    Thanks for answering.

     
    • Tim Cooper

      Tim Cooper - 2008-10-11

      I have just solved this same bug by modifying the source-code as follows:

          bool XmlRpcValue::fromXml(std::string const& valueXml, int* offset)
      ...
              else if (typeTag == STRUCT_TAG)
                  result = structFromXml(valueXml, offset);
              else if (typeTag == "<string/>") {    // tco's hack
                  _type = TypeString;
                  _value.asString = new std::string;
                  result = true;
              }
              else if (typeTag == VALUE_ETAG)        // Watch for empty/blank strings with no <string>tag
              {
                  *offset = afterValueOffset;     // back up & try again
                  result = stringFromXml(valueXml, offset);
              }

      (I've emailed this to the original author, Chris Morley, not sure if he's planning a new release.  I'll leave it to someone who knows their way around open source software to put this bugfix into the CVS repository).

       

Log in to post a comment.