tinyxml

TinyXML and fetching values

Hello, I'm trying to load data from xml-file with TinyXML (c++). int height = rootElem->attrib<int>("height", 480); rootElem is a root element of loaded xml-file. I want to load height value from it (integer). But I have a wrapper function for this stuff: template<typename T> T getValue(const string &key, const string &defaultValue ...

How to get parent node of element using tinyxml

Is there a way to get a parent node from a TiXmlElement? For example... TiXmlElement *parent = child->ParentElement( "someName" ); If you can't do this in tinyxml, are there any other xml parsers that allow this? ...

Segmentation Fault using Tinyxml

I'm trying to read an Xml file recursively using Tinyxml, but when I try to acces the data I get a "Segmentation Fault". here is the code : int id=0, categoria=0; const char* nombre; do{ ingrediente = ingrediente->NextSiblingElement("Ingrediente"); contador++; if(ingrediente->Attribute("id")!=NULL) id = atoi( ...

Compiling libraries with CMake under Cygwin

I have been trying to compile TinyXML using CMake as a sort of mini project, trying to learn CMake. As an addition I am trying to make it compile into a dynamic library and install itself so it works. So far I have managed to get it to compile and install BUT it compiles into a .dll and a .dll.a and the only way to get it to work is to ...

TinyXml save-formatting when using CDATA blocks

If I have this test code: TiXmlElement *parentElem = new TiXmlElement("ParentNode"); TiXmlElement *newElem = new TiXmlElement("TestNode"); TiXmlText *textElem = new TiXmlText("Test Content"); //textElem->SetCDATA(true); newElem->LinkEndChild(textElem); parentElem->LinkEndChild(newElem); With the line commented ...

Parsing <multi_path literal="not_measured"/> in TinyXML

Hello All, How do I parse the following in TinyXML: <multi_path literal="not_measured"/> I am able to easily parse the below line: <hello>1234</hello> The problem is that the first statement is not getting parsed the normal way. Please suggest how to go about this. ...

Why is this loop only running once?

Why is this loop only running once? noteDatabaseItem just takes a node and fills in the data. the xml has 3 notes in it. XML: <?xml version="1.0" encoding="utf-8"?> <noteCollection> <note name="Test Note 1">This is test note 1 content!</note> <note name="Test Note 2">This is test note 2 content!</note> <note name="Test Note 3">Th...

Requiring existence of XML elements without schema in TinyXML

I am trying to implement a short converter using TinyXML that will take an XML file (with fixed format), parse it, and populate a protobuf object with the elements. Problem is, some elements are optional in the protobuf definition and TinyXML does not have schema support. What would be a simple way to parse the elements robustly taking...

Using TinyXML over a byte stream instead of file

Hello All, Is it possible to use TinyXML over a byte stream instead of a file? Consider this code snippet: TiXmlDocument doc("abc.xml"); if (!doc.LoadFile()) return; TiXmlHandle hDoc(&doc); The above code snippet takes a file as input. How can I modify the code so that it accepts a byte stream? A sample code snippet would be great!...