Actually, you can use both libraries together.  Simply refrain from
mis-"using" them.

//    using foo1::DOMDocument;
//    using foo2::DOMDocument;

int
main( int argc, const char* argv[] )
{
    foo1::DomDocument doc1;
    foo2::DomDocument doc2;

    return(0);
}

      ***** OR *****

      using foo1::DOMDocument;
//    using foo2::DOMDocument;

int
main( int argc, const char* argv[] )
{
    DomDocument doc1;
    foo2::DomDocument doc2;

    return(0);
}

Sometimes "using" is appropriate and sometimes it isn't.  In this instance,
it's simply not appropriate.

Now, if we could just get a namespace something like:

namespace apache
{
  namespace xerces
  {
    namespace DOM
    {
      class Parser;
    }
    namespace SAX
    {
      class Parser;
    }
  }
  namespace xalan
  {
    ...
  }
}

We could always use something like:
  namespace dom = Apache::xerces::DOM;
to keep the code 'clean'.

Just my $.02



                                                                                       
                                                
                      David N                                                          
                                                
                      Bertoni/Cambridge         To:      [EMAIL PROTECTED]   
                                                
                      /IBM                      cc:                                    
                                                
                      <david_n_bertoni@         Subject: RE: Proposal Review: Using 
C++ Namespace                                      
                      us.ibm.com>                                                      
                                                
                                                                                       
                                                
                      11/07/2002 08:28                                                 
                                                
                      AM                                                               
                                                
                      Please respond to                                                
                                                
                      xerces-c-dev                                                     
                                                
                                                                                       
                                                
                                                                                       
                                                








Esmond,

I disagree.  Run this sample through your favorite compiler and see what
happens:

   namespace foo1
   {
       class DOMDocument
       {
       public:
           DOMDocument() {}
       };
   };

   using foo1::DOMDocument;


   namespace foo2
   {
       class DOMDocument
       {
       public:
           DOMDocument() {}
       };
   };


   using foo2::DOMDocument;

   int
   main(int argc, const char* argv[])
   {
       DOMDocument  doc;

       return 0;
   }

Since DOMDocument was hoisted by both header files (assuming the two
namespaces are in separate header files, from separate libraries), you
can't use both libraries together.  That defeats the purpose of using
namespaces in the first place.

Dave




                      "Pitt, Esmond"

                      <[EMAIL PROTECTED]>          To:
[EMAIL PROTECTED]

                                               cc:      (bcc: David N
Bertoni/Cambridge/IBM)
                      11/06/2002 03:45         Subject: RE: Proposal
Review: Using C++ Namespace
                      PM

                      Please respond

                      to xerces-c-dev





Tinny

As per my previous message, the 'correct' solution is to enumerate all the
namespace exports explicitly with using-declarations, e.g.

using Xerces::XercesDOMParser;
using Xerces::DOMDOcument;
// ...

in XercesDefs.hpp (or in each header file which exports a class). There is
no accidental namespace pollution with this technique, no
order-dependencies, and no user migration is required.

EJP

-----Original Message-----
From: Tinny Ng [mailto:tng-xml@;ca.ibm.com]
Sent: Thursday, 7 November 2002 12:53 AM
To: [EMAIL PROTECTED]
Subject: Re: Proposal Review: Using C++ Namespace


Hi everyone,

I have implemented the proposed C++ Namespace to the latest code base.
Since a number of response indicated no "using" clause in a global header,
I've removed that from the XercesDefs.hpp which then means users'
application has a migration item.

Please review the latest nightly build
(http://xml.apache.org/dist/xerces-c/nightly/2002-11-06/)  and let me know
any comment.

Thanks!

Tinny


---------------------------------------------------------------------
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]




---------------------------------------------------------------------
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