Hallo,
I have a pretty simple XML file for configuration:
<sliders>
<xyzFactor>0.5</xyzFactor>
<email>someone_at_mail.com</email>
</sliders>
Then when trying to do:
XMLFile* file = cache->GetResource<XMLFile>("Config/sliders.xml");
//String emailStr;
if (file)
{
XMLElement rootElem = file->GetRoot("sliders");
XPathQuery query;
if( query.SetQuery("email", "String")) {
String emailStr = query.EvaluateToString(rootElem);
URHO3D_LOGINFO("emailStr: " + emailStr);
}
if( query.SetQuery("xyzFactor", "Float")) {
float xyzfactor = query.EvaluateToFloat(rootElem);
URHO3D_LOGINFO("xyzfactor: " + String(xyzfactor));
}
query.Clear();
}
I see my log yield:
[Thu Aug 2 18:05:17 2018] INFO: emailStr:
[Thu Aug 2 18:05:17 2018] INFO: xyzfactor: 0.5
as if emailStr were empty.
So what’s wrong with query.EvaluateToString ?
query.EvaluateToFloat works as one can see above.
Thanks.