ibondiez / ticpp

Automatically exported from code.google.com/p/ticpp
0 stars 0 forks source link

Howto convert a document or an element to a string? #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the product are you using? On what operating system?
Between revision 65 and 81 the function GetAsString has been removed from
tinyxml.

I was hoping that the following would work:
ostringstream s;
s << doc;

Please provide any additional information below.
I really like this library it is really easy to use and is just a great C++
interface.

However I really do need to be able to read and write strings rather than
files as they go into a database as a compressed blob.

Original issue reported on code.google.com by duncan-g...@linuxowl.com on 27 Nov 2007 at 1:30

GoogleCodeExporter commented 9 years ago
Sorry this was my bad, I was compiling against the revision 65 headers and to 
make
matters worse doc was an std::auto_ptr<ticpp::Document>

The only problem is that for debugging unformatted text is tricky to read, it 
would
be nice if there were stream manipulators to control SetStreamPrinting() and 
SetIndent()

Original comment by duncan-g...@linuxowl.com on 29 Nov 2007 at 9:35

GoogleCodeExporter commented 9 years ago
Sorry about the slow response. 
We implemented GetAsString() in TinyXml++ at the same time as TiXmlPrinter was 
being
implemented in TinyXml. We chose to remove GetAsString() and support 
TiXmlPrinter,
because it provides the same functionality.

See here for documentation and an example:
http://ticpp.googlecode.com/svn/docs/classTiXmlPrinter.html

Original comment by rjmy...@gmail.com on 29 Nov 2007 at 11:40

GoogleCodeExporter commented 9 years ago
No problem about the response time.

By default the ostream has TiXmlPrinter::SetStreamPrinting() turned on I'm 
wondering
if there is a way to turn it off without removing the code?

It would be very nice to be able to use stream manipulators to do this.

Original comment by duncan-g...@linuxowl.com on 30 Nov 2007 at 7:03

GoogleCodeExporter commented 9 years ago
Neither the TiXmlPrinter nor the stream operator code are part of TinyXML++.
As far as I know, the author's philosophy is that the stream operators are to 
be used
for machine-readable output, as opposed to human-readable.

Please use the issue trackers or forum on the TinyXML Project Page on 
SourceForge:
http://sourceforge.net/projects/tinyxml/

Original comment by rjmy...@gmail.com on 30 Nov 2007 at 12:32