Menu

Recieving Structures

Help
Anonymous
2003-02-12
2003-02-13
  • Anonymous

    Anonymous - 2003-02-12

    hi,

    i hv a small problem with the values in a struct. here is how my response XML looks like:

    <value><struct>
    <member>
    <name>id</name>
    <value><string>titel</string></value>
    </member>
    <member>
    <name>mode</name>
    <value><string>r</string></value>
    </member>
    <member>
    <name>type</name>
    <value><string>string</string></value>
    </member>
    </struct></value>

    i print the values with this command:
    std::cout << "Name:" << result["id"] << " Type:" << result["type"] << " Mode:" << result["mode"] << "\n";

    and get:
    Name: <value>title</value> Type: <value>string</value> Mode: <value>rw</value>

    the question is, why are the <string> Tags removed, but not the <value> Tags??
    Do u expect a different kind of xml response?
    where and in what way do i hv to change the xmlrpc classes to solve my proplem?

    thanx
    bummel

     
    • David Monahan

      David Monahan - 2003-02-12

      Your output is what I would have expected.

      Note that <value>hello</value> is equivalent to <value><string>hello</string></value>.

      1) Your code translates the values back to XML. In the code for converting a string value to xml ( stringToXml() ) the <string> tags are suppressed. You can see these optional lines commented out in stringToXml() in XmlRpcValue.cpp.

      2) If you want the data returned try using:
      std::cout << "Name: " << std::string(result["id"]) << std::endl;

      David

       
    • Chris Morley

      Chris Morley - 2003-02-13

      I don't use the ostream << operator internally, it was just implemented as a debug convenience. It currently just dumps out exactly what the wire encoding of the value would be.

      It people prefer, I can recode it to dump the "natural" values instead (although its not clear what format arrays and structs ought to be in...)

      Chris

       

Log in to post a comment.