// XmlParser.h #ifndef XmlParser_H #define XmlParser_H // David Adams // July 2002 // // Parser to create an XmlElement from an XML file. // // Xerces DOM is used to parse the XML files. #include #include "dataset_util/XmlElement.h" class XmlParser { public: // Embedded classes // Implementation class class Imp; private: // data // Implementation. Imp* pimp; private: // Hidden functions. // Copy constructor. XmlParser(const XmlParser&); // Assignment. XmlParser& operator=(const XmlParser&); public: // const methods // Constructor. XmlParser(); // Destructor. ~XmlParser(); // Parse an XML string or a file. // Argument is assumed to be a file name if the first // chracter is not '<'; // Caller is responsible for managing (deleting) the element. const XmlElement* parse(std::string filename); // Write an XmlElement into a file. // The XML type of the element must be registered in DtdRegistry // so the name of the DTD file can be included in the file. // Returns nonzero for error. int write(std::string filename, const XmlElement& ele); }; #endif