dbertoni    2003/07/01 13:33:22

  Modified:    c/src/xalanc/DOMSupport DOMServices.cpp DOMServices.hpp
  Log:
  New generic function for resolving namespace prefix.
  
  Revision  Changes    Path
  1.2       +38 -0     xml-xalan/c/src/xalanc/DOMSupport/DOMServices.cpp
  
  Index: DOMServices.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/DOMSupport/DOMServices.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DOMServices.cpp   29 Jun 2003 03:57:53 -0000      1.1
  +++ DOMServices.cpp   1 Jul 2003 20:33:22 -0000       1.2
  @@ -77,6 +77,7 @@
   
   
   #include <xalanc/PlatformSupport/DOMStringHelper.hpp>
  +#include <xalanc/PlatformSupport/PrefixResolver.hpp>
   #include <xalanc/PlatformSupport/XalanUnicode.hpp>
   
   
  @@ -780,6 +781,43 @@
        }
   
        return theNamespace;
  +}
  +
  +
  +
  +const XalanDOMString*
  +DOMServices::getNamespaceForPrefix(
  +                     const XalanDOMChar*             theName,
  +                     const PrefixResolver&   thePrefixResolver,
  +                     bool                                    isAttribute,
  +                     XalanDOMString&                 thePrefix)
  +{
  +     const XalanDOMString::size_type         theLength = length(theName);
  +
  +     // Check for special default namespace value...
  +     if (isAttribute == true && equals(s_XMLNamespace, theName, theLength) 
== true)
  +     {
  +             return &s_XMLNamespacePrefixURI;
  +     }
  +     else
  +     {
  +             const XalanDOMString::size_type         theColonIndex = 
indexOf(theName, XalanUnicode::charColon);
  +
  +             if (theColonIndex == theLength)
  +             {
  +                     clear(thePrefix);
  +
  +                     return 
thePrefixResolver.getNamespaceForPrefix(s_emptyString);
  +             }
  +             else
  +             {
  +                     // Get the prefix from theName...
  +                     assign(thePrefix, theName, theColonIndex);
  +                     assert(length(thePrefix) != 0);
  +
  +                     return 
thePrefixResolver.getNamespaceForPrefix(thePrefix);
  +             }
  +     }
   }
   
   
  
  
  
  1.2       +17 -0     xml-xalan/c/src/xalanc/DOMSupport/DOMServices.hpp
  
  Index: DOMServices.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/DOMSupport/DOMServices.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DOMServices.hpp   29 Jun 2003 03:57:53 -0000      1.1
  +++ DOMServices.hpp   1 Jul 2003 20:33:22 -0000       1.2
  @@ -571,6 +571,23 @@
                        const XalanElement&             namespaceContext);
   
        /**
  +      * Retrieve the URI corresponding to a namespace prefix, using the 
supplied
  +      * name, and PrefixResolver.  The routine also returns the prefix.
  +      * 
  +      * @param theName           The name that contains the prefix
  +      * @param thePrefixResolver The PrefixResolver to use
  +      * @param isAttribute       If true, special rules for attributes are 
used
  +      * @param thePrefix         The prefix
  +      * @return URI corresponding to namespace
  +      */
  +     static const XalanDOMString*
  +     getNamespaceForPrefix(
  +                     const XalanDOMChar*             theName,
  +                     const PrefixResolver&   thePrefixResolver,
  +                     bool                                    isAttribute,
  +                     XalanDOMString&                 thePrefix);
  +
  +     /**
         * Determine if a node is after another node, in document order.
         *
         * @param node1 The first node
  
  
  

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

Reply via email to