00001 #ifndef __XML_DOCUMENT_H
00002 #define __XML_DOCUMENT_H
00003
00004 #include "mimasconfig.h"
00005
00006 #ifdef HAVE_XALAN
00007
00008 #include <string>
00009 #include <XalanDOM/XalanDocument.hpp>
00010 #include <XalanDOM/XalanElement.hpp>
00011 #include <XalanSourceTree/XalanSourceTreeDOMSupport.hpp>
00012 #include <XalanSourceTree/XalanSourceTreeParserLiaison.hpp>
00013 #ifndef SIMPLEXPATH
00014
00015 #include <XPath/XPathEnvSupportDefault.hpp>
00016 #include <XPath/XObjectFactoryDefault.hpp>
00017 #if _XALAN_VERSION >= 10500
00018 #include <XPath/XPathConstructionContextDefault.hpp>
00019 #endif
00020 #include <XPath/XPathFactoryDefault.hpp>
00021 #include <XPath/XPathExecutionContextDefault.hpp>
00022 #endif
00023 #include <util/XMLException.hpp>
00024 #include "mimasexception.h"
00025 #include "object.h"
00026 #include "xml_errorhandler.h"
00027 #include "xml_reference.h"
00028
00029 #ifdef XERCES_HAS_CPP_NAMESPACE
00030 using namespace XERCES_CPP_NAMESPACE;
00031 #endif
00032 #ifdef XALAN_HAS_CPP_NAMESPACE
00033 using namespace XALAN_CPP_NAMESPACE;
00034 #endif
00035
00036 namespace mimas {
00037
00066 class xml_document: public object
00067 {
00068 public:
00076 xml_document( const std::string &schemaURI );
00080 void load( const char *fileName ) throw (mimasexception);
00083 void save( const char *fileName ) throw (mimasexception);
00086 void fromString( const std::string &string ) throw (mimasexception);
00089 void fromInputSource( InputSource &inputSource ) throw (mimasexception);
00092 const XalanDocument *getDocument(void) const
00093 { return document; }
00096 xml_reference< XalanElement > getDocumentElement(void)
00097 { return xml_reference< XalanElement >
00098 ( document->getDocumentElement(), this ); }
00099 #ifndef SIMPLEXPATH
00100
00101
00102
00103 XalanSourceTreeDOMSupport *getDOMSupport(void)
00104 { return &theDOMSupport; }
00106 XPathEnvSupportDefault *getEnvSupport(void) { return &theEnvSupport; }
00107 #if _XALAN_VERSION >= 10500
00109 XPathConstructionContextDefault *getXPathConstructionContext(void)
00110 { return &theXPathConstructionContext; }
00111 #endif
00113 XPathFactoryDefault *getXPathFactory(void) { return &theXPathFactory; }
00115 XPathExecutionContextDefault *getExecutionContext(void)
00116 { return &theExecutionContext; }
00118 #endif
00119 protected:
00121
00122
00123 XalanSourceTreeDOMSupport theDOMSupport;
00125 XalanSourceTreeParserLiaison theLiaison;
00128 xml_errorhandler xmlErrorHandler;
00130 const XalanDocument *document;
00131 #ifndef SIMPLEXPATH
00132
00133
00134
00135 XPathEnvSupportDefault theEnvSupport;
00137 XObjectFactoryDefault theXObjectFactory;
00138
00139 #if _XALAN_VERSION >= 10500
00141 XPathConstructionContextDefault theXPathConstructionContext;
00142 #endif
00144 XPathFactoryDefault theXPathFactory;
00146 XPathExecutionContextDefault theExecutionContext;
00148 #endif
00149 };
00150
00152 std::istream &operator>>( std::istream &stream, xml_document &document );
00153
00155
00156
00157 };
00158
00159 #endif
00160
00161 #endif