00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00015
00017
00018 #if !defined(AFXQ_XQSCOPEDNAMESPACE_H__D6A320F5_21F1_421D_9E46_E4373B375E1A__INCLUDED_)
00019 #define AFXQ_XQSCOPEDNAMESPACE_H__D6A320F5_21F1_421D_9E46_E4373B375E1A__INCLUDED_
00020
00021 #include <xqilla/framework/XQillaExport.hpp>
00022 #include <xqilla/dom-api/impl/XQillaNSResolverImpl.hpp>
00023 #include <xqilla/context/StaticContext.hpp>
00024
00025 XERCES_CPP_NAMESPACE_BEGIN
00026 class DOMXPathNSResolver;
00027 class DOMNode;
00028 XERCES_CPP_NAMESPACE_END
00029
00030 class XQILLA_API XQScopedNamespace : public XQillaNSResolverImpl
00031 {
00032 public:
00033 XQScopedNamespace(XPath2MemoryManager* memMgr, const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver* prevScope);
00034 virtual ~XQScopedNamespace();
00035
00036 virtual const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const;
00037 virtual const XMLCh* lookupPrefix(const XMLCh* uri) const;
00038
00039 void setNodeContext(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node);
00040 protected:
00041 const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver* _prevScope;
00042 const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* _ctxNode;
00043 };
00044
00045 class XQILLA_API AutoNsScopeReset
00046 {
00047 public:
00048 AutoNsScopeReset(StaticContext* context, XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver* newResolver)
00049 {
00050 _context=context;
00051 _oldNSResolver=_context->getNSResolver();
00052 _defaultElementAndTypeNS=context->getDefaultElementAndTypeNS();
00053 _context->setNSResolver(newResolver);
00054 }
00055
00056 ~AutoNsScopeReset()
00057 {
00058 _context->setNSResolver(_oldNSResolver);
00059 _context->setDefaultElementAndTypeNS(_defaultElementAndTypeNS);
00060 }
00061
00062 protected:
00063 StaticContext* _context;
00064 const XERCES_CPP_NAMESPACE_QUALIFIER DOMXPathNSResolver* _oldNSResolver;
00065 const XMLCh *_defaultElementAndTypeNS;
00066
00067 };
00068
00069 #endif // !defined(AFXQ_XQSCOPEDNAMESPACE_H__D6A320F5_21F1_421D_9E46_E4373B375E1A__INCLUDED_)