BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
test_mem.cxx File Reference
#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 ()
 

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 34 of file test_mem.cxx.

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