Yes, there shouldn't be a problem doing this.  Are you having problems
doing it?

You can also use a DOM_Node as a key in an STL map, with a few
"enhancements."  Here's how we do it in Xalan-C++:

   class XercesDOM_NodeHack : public DOM_Node
   {
   public:

      XercesDOM_NodeHack(const DOM_Node& theNode) :
           DOM_Node(theNode)
      {
      }

      XercesDOM_NodeHack(NodeImpl*  theImpl = 0) :
           DOM_Node(theImpl)
      {
      }

      ~XercesDOM_NodeHack()
      {
      }

      NodeImpl*
      getImpl() const
      {
           return fImpl;
      }

      static NodeImpl*
      getImpl(const DOM_Node&       theNode)
      {
   #if defined(XALAN_OLD_STYLE_CASTS)
           return ((const XercesDOM_NodeHack&)theNode).getImpl();
   #else
           return static_cast<const XercesDOM_NodeHack&>(theNode).getImpl
   ();
   #endif
      }
   };

   inline bool
   operator<(
           const DOM_Node&     theLHS,
           const DOM_Node&     theRHS)
   {
   #if !defined(XALAN_NO_NAMESPACES)
      using std::less;
   #endif

      return less<NodeImpl*, NodeImpl*>()(
           XercesDOM_NodeHack::getImpl(theLHS),
           XercesDOM_NodeHack::getImpl(theRHS));
   }

Of course if asked, I'll deny I _ever_ wrote this code ;-)  And if you do
_anything_ with the implementation pointer, then you're on your own.

Dave



                                                                                       
               
                    Erez Greenstein                                                    
               
                    <Erez_Greenstein@CreoS        To:     
"'[EMAIL PROTECTED]'"             
                    citex.com>                    <[EMAIL PROTECTED]>        
               
                                                  cc:     (bcc: David N 
Bertoni/CAM/Lotus)            
                    07/10/2001 01:30 AM           Subject:     using XML DOM with STL  
               
                    Please respond to                                                  
               
                    xerces-c-dev                                                       
               
                                                                                       
               
                                                                                       
               




I am trying to use STL  map with DOM_Node  as its value ?
Is it possible ?
 any help will be appreciated .


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to