[Q] Extracting the key members of an XmlRpcValue object

M

mtp1032

I need to be able to extract the values from an XmlRpcValue where I do
not know in advance what the keys are, or how many exist. For example,
suppose I have an XmlRpcValue, object, returned by some xml-rpc method,

XmlRpc::XmlRpcValue xmlVal = some_xmlrpc_method(...);

that when printed to std::cout, i.e.,

std::cout << xmlVal << std::endl;

yields the following:

{
eventType: "BIRTH",
mother: "Michelle",
gender: "MALE"
}

Knowing the keys (i.e., 'eventType', 'mother', and 'gender') extracting
the value (i.e., "BIRTH", "Michelle", or "MALE") is straightfoward.
However, suppose I do not know what are the keys? What code could write
to obtain key for each member? In other words, what code do implement
that, when executed, will return the string "eventType", "mother", or
"gender".

Thanks, in advance,

Michael
 
S

shez

mtp1032 said:
I need to be able to extract the values from an XmlRpcValue where I do
not know in advance what the keys are, or how many exist. For example,
suppose I have an XmlRpcValue, object, returned by some xml-rpc method,

XmlRpc::XmlRpcValue xmlVal = some_xmlrpc_method(...);

that when printed to std::cout, i.e.,

std::cout << xmlVal << std::endl;

yields the following:

{
eventType: "BIRTH",
mother: "Michelle",
gender: "MALE"
}

Knowing the keys (i.e., 'eventType', 'mother', and 'gender') extracting
the value (i.e., "BIRTH", "Michelle", or "MALE") is straightfoward.
However, suppose I do not know what are the keys? What code could write
to obtain key for each member? In other words, what code do implement
that, when executed, will return the string "eventType", "mother", or
"gender".

Thanks, in advance,

Michael

Michael,

XmlRpcValue is not a standard C++ component. Please refer to the
documentation that comes with your library.

-shez-
 
J

Jack Klein

I need to be able to extract the values from an XmlRpcValue where I do
not know in advance what the keys are, or how many exist. For example,
suppose I have an XmlRpcValue, object, returned by some xml-rpc method,

First you need to realize that "xmlprc" is not something defined by
the C++ language, so nobody here necessarily has any idea at all what
you are talking about.
XmlRpc::XmlRpcValue xmlVal = some_xmlrpc_method(...);

What is an object of type XmlRpcValue? Obviously it is defined by
some compiler extension or 3rd party library you are using.
that when printed to std::cout, i.e.,

std::cout << xmlVal << std::endl;

yields the following:

{
eventType: "BIRTH",
mother: "Michelle",
gender: "MALE"
}

Knowing the keys (i.e., 'eventType', 'mother', and 'gender') extracting
the value (i.e., "BIRTH", "Michelle", or "MALE") is straightfoward.
However, suppose I do not know what are the keys? What code could write
to obtain key for each member? In other words, what code do implement
that, when executed, will return the string "eventType", "mother", or
"gender".

Thanks, in advance,

Michael

What does the data inside the XmlRpcValue object look like? Without
knowing what the object is, how can you expect anyone here to tell you
how to extract data from it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,244
Members
46,839
Latest member
MartinaBur

Latest Threads

Top