#include "xmlBase/XmlParser.h"
#include "xmlBase/Dom.h"
#include <xercesc/dom/DOMElement.hpp>
#include <xercesc/dom/DOMNodeList.hpp>
#include <string>
#include <iostream>
#include <fstream>
Go to the source code of this file.
Functions | |
std::string | doc_string ("<?xml version=\"1.0\" ?>""<!DOCTYPE TopElement ["" <!ELEMENT TopElement (ChildElt*) >"" <!ELEMENT ChildElt (ChildWithText | EmptyChild)* >"" <!ATTLIST ChildElt anAttribute CDATA #REQUIRED >"" <!ELEMENT ChildWithText (#PCDATA) >"" <!ATTLIST ChildWithText attr CDATA #IMPLIED>"" <!ELEMENT EmptyChild EMPTY> ]"">""<TopElement>"" <ChildElt anAttribute=\"I'm nested but empty\" />"" <ChildElt anAttribute=\"I'm nested with content\">"" <ChildWithText attr=\"text content\" >"" Text content here."" </ChildWithText>"" <EmptyChild />"" </ChildElt>""</TopElement>") |
Test program for xml facility. Parse xml file and write it out to a stream. | |
int | main () |
std::string doc_string | ( | "<?xml version=\"1.0\" ?>""<!DOCTYPE TopElement ["" <!ELEMENT TopElement (ChildElt*) >"" <!ELEMENT ChildElt (ChildWithText | EmptyChild)* >"" <!ATTLIST ChildElt anAttribute CDATA #REQUIRED >"" <!ELEMENT ChildWithText (#PCDATA) >"" <!ATTLIST ChildWithText attr CDATA #IMPLIED>"" <!ELEMENT EmptyChild EMPTY> ]"">""<TopElement>"" <ChildElt anAttribute=\"I'm nested but empty\" />"" <ChildElt anAttribute=\"I'm nested with content\">"" <ChildWithText attr=\"text content\" >"" Text content here."" </ChildWithText>"" <EmptyChild />"" </ChildElt>""</TopElement>" | ) |
int main | ( | ) |
Definition at line 34 of file test_mem.cxx.
References doc_string(), and xmlBase::Dom::prettyPrintElement().
00034 { 00035 XERCES_CPP_NAMESPACE_USE 00036 00037 xmlBase::XmlParser parser; 00038 00039 DOMDocument* doc = parser.parse(doc_string); 00040 00041 if (doc != 0) { // successful 00042 std::cout << "Document successfully parsed" << std::endl; 00043 DOMElement* docElt = doc->getDocumentElement(); 00044 xmlBase::Dom::prettyPrintElement(docElt, std::cout, ""); 00045 } 00046 return(0); 00047 }