Advertisement
slatenails

xml test

Sep 14th, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include "../libcobaltcore/xml.h"
  2. #include "../libcobaltcore/format.h"
  3.  
  4. int main() {
  5.     CoXMLDocument* doc = new CoXMLDocument (new CoXMLNode ("test", null));
  6.     CoXMLNode* subnode = new CoXMLNode ("subnode", doc->root());
  7.     subnode->setAttribute ("a", "hi!");
  8.     subnode->setAttribute ("b", "test");
  9.    
  10.     CoXMLNode* test1 = new CoXMLNode ("test", subnode);
  11.     CoXMLNode* test2 = new CoXMLNode ("test", subnode);
  12.     CoXMLNode* test3 = new CoXMLNode ("test", subnode);
  13.     CoXMLNode* test4 = new CoXMLNode ("test", subnode);
  14.    
  15.     test1->setContents ("This is a test non-<formatted> string");
  16.     test1->setCDATA (true);
  17.     test2->setContents ("Another test!");
  18.     test3->setContents ("8)");
  19.     test4->setContents ("1 + 2 = 3!");
  20.    
  21.     CoXMLNode::newSelfEnclosingNode ("subnodish", doc->root());
  22.     return doc->save ("test-2.xml");
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement