XQScopedNamespace.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2006
00003  *     DecisionSoft Limited. All rights reserved.
00004  * Copyright (c) 2004-2006
00005  *     Progress Software Corporation. All rights reserved.
00006  * Copyright (c) 2004-2006
00007  *     Oracle. All rights reserved.
00008  *
00009  * See the file LICENSE for redistribution information.
00010  *
00011  * $Id: XQScopedNamespace.hpp,v 1.6 2006/11/01 16:37:12 jpcs Exp $
00012  */
00013 
00015 // XQScopedNamespace.hpp: interface for the XQScopedNamespace class.
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_)

Generated on Mon Feb 12 16:52:06 2007 for XQilla Simple API by  doxygen 1.4.6