Questions tagged [tinyxml]

TinyXML is a simple, small C++ XML parser and generator library.

TinyXML is a simple, small, C++ parser that can be easily integrated into other programs. It is released under the ZLib license.

In brief, TinyXML parses an XML document, and builds from that a Document Object Model (DOM) object that can be browsed, manipulated and serialized within your C++ code. TinyXML also allows you to construct an XML document from scratch with C++ objects and write this to disk or another output stream.

TinyXML is designed to be easy and fast to learn. It consists of two headers and four source files which can either be compiled into your binary or built into a static library.

TinyXML attempts to be a flexible parser, but with truly correct and compliant XML output. It should compile on any reasonably C++ compliant system, does not rely on exceptions or RTTI, and can be compiled with or without STL support. TinyXML fully supports the UTF-8 encoding, and the first 64k character entities. However, TinyXML doesn't parse or use or .

216 questions
19
votes
1 answer

Can TinyXml load Xml from string instead of file?

I'm using TinyXml library for my application but TiXmlDocument object just only can load Xml file. How can it load Xml from string. Could you tell me the way to do this. Thank you very much Tu.
user339996
  • 193
  • 1
  • 1
  • 5
14
votes
4 answers

TinyXML: Save document to char * or string

I'm attempting to use TinyXML to read and save from memory, instead of only reading and saving files to disk. It seems that the documnent's parse function can load a char *. But then I need to save the document to a char * when I'm done with it.…
foobar
  • 739
  • 3
  • 10
  • 17
12
votes
3 answers

How does the UTF-8 support of TinyXML work?

I'm using TinyXML to parse/build XML files. Now, according to the documentation this library supports multibyte character sets through UTF-8. So far so good I think. But, the only API that the library provides (for getting/setting element names,…
Roel
  • 18,290
  • 6
  • 56
  • 82
9
votes
4 answers

Should I use XPath or just DOM?

I have a bunch of hierarchical data stored in an XML file. I am wrapping that up behind hand-crafted classes using TinyXML. Given an XML fragment that describes a source signature as a set of (frequency, level) pairs a bit like this:
Pete
  • 1,091
  • 1
  • 8
  • 20
8
votes
3 answers

Tinyxml - Link errors when targeting x64 platform

I'm using tinyxml library for parsing XML files in my project. When I try to target x64 platforms I get LINKER errors and here is one fo them: Error 4 error LNK2001: unresolved external symbol "private: static struct TiXmlString::Rep…
Kira
  • 1,093
  • 4
  • 24
  • 62
7
votes
3 answers

pugixml vs tinyxml

Short question: any comments on comparison of pugixml and tinyxml please? Details I need to use an XML parser/writer. My software is written in C++. It seems to me TinyXML and pugixml are both good options (RapidXML is good as well but its interface…
sw_eng
  • 129
  • 1
  • 2
  • 7
7
votes
2 answers

How to use TinyXml to parse for a specific element

I would like to parse a group of elements out of a TinyXml output. Essentially, I need to pick out any port element's "portid" attribute of the port has a state of "open" (shown below for port 23). What's the best way to do this? Here's the…
Jack BeNimble
  • 33,194
  • 33
  • 113
  • 187
6
votes
1 answer

How to count elements in TinyXml?

I think problem is with wrong using function or something else. This part of code is working but the result isn't well. TiXmlElement* e = hDoc.FirstChildElement().Element(); // think problem is there while (e) { e = e->NextSiblingElement(); …
Max
  • 105
  • 2
  • 7
6
votes
3 answers

Parsing XML Elements using TinyXML

UPDATE: Still not working :( I have updated the code portion to reflect what I currently have. This should be a pretty easy question for people who have used TinyXML. I'm attempting to use TinyXML to parse through an XML document and pull out some…
Jon
  • 2,952
  • 11
  • 45
  • 92
6
votes
1 answer

Comparing to a hardcoded string with quotes in C++

I'm writing a c++ function to generate XML using TinyXML. I'd like to verify that a (relatively small) tree produced by my function gets turned into a string identical to a reference string. // intended XML: It seems like…
tasteslikelemons
  • 377
  • 1
  • 2
  • 8
5
votes
2 answers

Specialisation of function template in another class/namespace?

NOTE: This question is only loosely related to tinyxml, however including details like that may help illustrate the concept better. I have written a function template that will iterate through a parent XML nodes children, retrieve the value of the…
Adam Marshall
  • 2,542
  • 7
  • 32
  • 70
5
votes
2 answers

What memory management do I need to cleanup when using TinyXml for C++?

I'm doing the following with TinyXml: TiXmlDocument doc; TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" ); TiXmlElement* main = new TiXmlElement("main"); TiXmlElement* header = new…
Alex B
  • 23,784
  • 13
  • 60
  • 84
5
votes
3 answers

How to convert an XMLElement to string in TinyXML2

In TinyXml 1 it was possible to convert a child element to a string using the << operator, e.g. TiXmlElement * pxmlChild = pxmlParent->FirstChildElement( "child" ); std::stringstream ss; ss << (*pxmlChild); This doesn't appear possible in TinyXml2.…
snowdude
  • 3,764
  • 1
  • 16
  • 26
4
votes
1 answer

How do I get the name of a tag in TinyXML?

For example: test.xml whatever How can I get the name-string of the tag "fruit" (which would be "fruit" of course) using TinyXML?
TravisG
  • 2,203
  • 2
  • 28
  • 45
4
votes
2 answers

TinyXML Debian Installation

Can someone give me some instructions on how to install TinyXML (or TinyXML++) to debian so I can use it from within my C++ app. I've never installed a library before so I have no idea what to do. Thanks
Jack
  • 3,691
  • 6
  • 20
  • 31
1
2 3
14 15