navi homePPSaboutscreenshotsdownloaddevelopmentforum

This is an archived page!
This page is very old and the content is not up to date.
Not everything (if any) which is written here will be in the final game!


Under construction


Suggestion: Simple C++ class for XML writing from Oboltus.

Using this class is very very simple, it's all based on the stream operator <<. Here's an example:

ofstream f("sample.xml");
XmlStream xml(f);

xml << prolog() // write XML file declaration
  << tag("sample-tag") // root tag

    << tag("some-tag") // child tag
      << attr("int-attribute") << 123
      << attr("double-attribute") << 456.789
      << chardata() << "This is the text"
    << endtag() // close current tag

    << tag("empty-self-closed-tag") // sibling of <some-tag>
    << endtag()

    << tag() << "computed-name-tag"
      << attr("text-attr") << "a bit of text"
    << endtag()

    << tag("deep-tag") // deep enclosing
      << tag("sub-tag-2")
        << tag("sub-tag-3")
    << endtag("deep-tag"); // close all tags up to specified

// you don't worry about closing all open tags!


<?xml version="1.0"?>
<some-tag int-attribute="123" double-attribute="456.789">This is the text
<computed-name-tag text-attr="a bit of text"/>

The layout isn't optimal yet, but I'll try to fix that.


See XML-Loader for an XML-Reader description

Last modified 2 years ago Last modified on Apr 15, 2017, 3:11:49 PM