Question about TiXMLElement. Print content on screen

I would like to print some error output when a XML definition is not properly formed. Then, I see in the code we usually access the fields using GetParameter("fieldName", ele) where ele is a TiXMLElement.

Now, if the fieldName is not properly defined I would like to print out in screen the full ele definition.

Having a look to the TiXML API

http://www.grinninglizard.com/tinyxmldocs/classTiXmlElement.html

I would guess what I need is just to call the GetText method.

However, if I do ele->GetText() it prints nothing.

Do you know the right way to do this?

GetText actualy returns the text of the xml secion, not the string content of it.
The text is the part of the xml content that is not surrounded by <, /> pairs:

To get the full string content, you can use TRestMetadata::ElementToString() method

1 Like

Ok, thanks! ElementToString works smoothly.