Skip to content
cscheiblich edited this page Jan 2, 2015 · 5 revisions

XMLCC

 `DOM::Root* xml = 0;
  xml = new DOM::Root( "xmlcc.html", new DOM::Doctype( ),
    new DOM::Comment( "XMLCC 1.00 20150101 Amara Faith" ),
    new DOM::Element( "html",
      new DOM::Element( "head",
        new DOM::Element( "title",
          new DOM::Value( "HTML generated by XMLCC" ) ) ),
      new DOM::Element( "body" ),
      new DOM::Element( "center",
        new DOM::Comment( "HTML was generated by XMLCC" ),
        new DOM::Value( "Hello" ),
        new DOM::Element( "b", new DOM::Value( "WWW" ) ),
        new DOM::Value( "from XMLCC" ), new DOM::Element( "br" ),
        new DOM::Element( "a",
          new DOM::Attribute( "href", "http://code.google.com/p/xmlcc/" ),
          new DOM::Value( "visit project page" ) ) ) ) );

  // std::cout << std::endl << std::flush;
  // std::cout << xml << std::endl << std::flush; // DOM:: 2 std::cout

  std::cout << "Writing xmlcc's config to file .. " << std::flush;
  std::fstream file; // open file
  file.open( ( (char*)( xml->getStr( ).c_str( ) ) ), std::ios::out );
  file << xml; // DOM tree 2 std::ostream
  file.close( );
  delete xml; // deletes complete DOM tree
  std::cout << "done!" << std::endl << std::flush;`
Clone this wiki locally