#41 typed values of the 'text'(or other value)

open
nobody
None
5
2005-10-29
2005-10-29
Lieven de Cock
No

Hello,

For the moment you can retrieve values of attributes as
int, double, text.
It would be nice to have the same functionality for the
text part (often also representing values).

Example :
<Person>
<Name>Test</Name>
<Age>33</Age>
<Height>1.75</Height>
</Person>

Now you can only get them as text, and then later on
one has to translate them to other typed variables.

Could something as below be implemented ?
int QueryIntText (const char *name, int *_value) const
int QueryDoubleText (const char *name, double *_value)
const
int QueryFloatText (const char *name, float *_value) const

An implementation can be as stupid/simple as :
TiXmlElement* pPerc = ....... anyway to get here ....;
TiXmlElement Dummy("Dummy");
Dummy.SetAttribute("value", pEl->GetText());
int n = 0;
Dummy.Attribute("value", &n);
and so on for the other types.

kind regards,
Lieven

Discussion

  • Paco Arjonilla
    Paco Arjonilla
    2005-12-29

    Logged In: YES
    user_id=864753

    I was going to post the same request.
    Best Regards,
    Paco