BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
test_mem.cxx File Reference
#include "xmlBase/Dom.h"
#include "xmlBase/XmlParser.h"
#include <xercesc/dom/DOMElement.hpp>
#include <xercesc/dom/DOMNodeList.hpp>
#include <fstream>
#include <iostream>
#include <string>

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 ()

Function Documentation

◆ doc_string()

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.

Referenced by main().

◆ main()

int main ( )

Definition at line 31 of file test_mem.cxx.

31 {
32 XERCES_CPP_NAMESPACE_USE
33
34 xmlBase::XmlParser parser;
35
36 DOMDocument* doc = parser.parse( doc_string );
37
38 if ( doc != 0 )
39 { // successful
40 std::cout << "Document successfully parsed" << std::endl;
41 DOMElement* docElt = doc->getDocumentElement();
42 xmlBase::Dom::prettyPrintElement( docElt, std::cout, "" );
43 }
44 return ( 0 );
45}
static void prettyPrintElement(DOMNode *elt, std::ostream &out, std::string prefix)
Definition Dom.cxx:574
DOMDocument * parse(const char *const filename, const std::string &docType=std::string(""))
Parse an xml file, returning document node if successful.
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.