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 .

219 questions
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,854
  • 1
  • 18
  • 27
4
votes
3 answers

Runtime error with tinyXML element access

yester day was my first attempt. I am trying to catch the variable "time" in the following "new.xml" file
Go to the Toy store!
prabhakaran
  • 5,126
  • 17
  • 71
  • 107
4
votes
2 answers

TinyXML Iterating over a Subtree

Does anyone have code to iterate through the nodes of a subtree in TinyXML? IE: Given a parent, iterate through all its children and all of its children's children?
Raindog
  • 1,468
  • 3
  • 14
  • 28
3
votes
1 answer

Write XML to txt file with TinyXml

I have a simple XML file but large. Let's say 98667 Hiking Boots 34.99 10123 Work Gloves
Miek
  • 1,127
  • 4
  • 20
  • 35
3
votes
2 answers

How to create separate library for include in C++/Eclipse

I've gotten some C++ code to work with the TinyXML parser. However, to do this I had to include the source code from TinyXML with my regular source code. I'd like to have TinyXML included as a separate library. I'm using Eclipse with the Cygwin C++…
Jack BeNimble
  • 35,733
  • 41
  • 130
  • 213
3
votes
1 answer

When TinyXML visitor function returns false, why does it stop parsing siblings?

We have adopted Tiny XML as our XML parser. I am writing code to grab palettes out of an XML file, and wrote a visitor function like this: PALETTE_PARSER::VisitEnter( const TiXmlElement& Element, const TiXmlAttribute* First Attribute) { if(…
andrewdski
  • 5,255
  • 2
  • 20
  • 20
3
votes
4 answers

TinyXML parsing a string in XML format returns NULL?

I'm trying to use TinyXML to parse a string with XML format. But the return pointer is always NULL. I'm not sure which part of code is setting wrong. TiXmlDocument docTemp; const string strData = "World"; const…
roboren
  • 891
  • 1
  • 7
  • 5
3
votes
2 answers

TinyXML #include problem... Using libraries

Hey, i'm really trying to get TinyXML to at least read a file but it says "main.cpp:8: error: ‘TiXMLDocument’ was not declared in this scope" This is the code im using: TiXMLDocument("demo.xml"); Ideally i want to read able to read files and output…
CurtisJC
  • 680
  • 3
  • 9
  • 23
3
votes
2 answers

Adding XML elements and attributes

I have the following XML structure so that I can add my configuration details to lastconnected element: Now I want to do some XML operation like adding elements…
Simsons
  • 12,295
  • 42
  • 153
  • 269
3
votes
2 answers

Using TinyXML over a byte stream instead of file

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…
webgenius
  • 856
  • 3
  • 13
  • 30
3
votes
3 answers

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: This is test note 1 content!
Will03uk
  • 3,346
  • 8
  • 34
  • 40
3
votes
2 answers

Deep Copy an XML via TinyXML

I am using tinyxml. How do I duplicate or create a copy of an existing XMLDocument? http://www.grinninglizard.com/tinyxmldocs/classTiXmlDocument.html#a4e8c1498a76dcde7191c683e1220882 I went through this link that says using Clone to replicate a…
David Luiz
  • 31
  • 1
  • 2
3
votes
5 answers

Using TinyXML ( linking libraries ? in c++ )

+Hi... i am a newbie ... and i don't know how to include external libraries in c++. This is sooo hard. I want to use TinyXML. so i made this : example2.cpp #include #include "tinyxml.h" void write_app_settings_doc( ) { …
mr.bio
  • 1,646
  • 4
  • 19
  • 27
3
votes
1 answer

Boost streambuf to const char* with buffer_cast vs std::string vs ostringstream

I have a client/server application using boost::read_until with a boost::streambuf. I'm reading an XML message from a socket and want to parse this with tinyXML2 like so: XMLDocument doc; doc.parse(strPtr); // strPtr is const char* I need to…
frankhond
  • 427
  • 4
  • 15
3
votes
2 answers

load XML from variable, not File

I'm trying to parse XML data stored in a variable, not a file. The reason for this is that program x replies to program y in XML, so it would seem to be best to directly parse the XML from the variable. So far I have tried to do this in TinyXML, but…
stan
  • 4,885
  • 5
  • 49
  • 72
1
2
3
14 15