dbertoni    00/04/18 08:30:49

  Modified:    c/src/DOMSupport DOMServices.cpp DOMServices.hpp
                        NamespaceResolver.cpp
               c/src/XMLSupport FormatterToHTML.cpp
               c/src/XPath QName.cpp SimpleNodeLocator.cpp
               c/src/XSLT ElemAttribute.cpp ElemElement.cpp
                        ElemLiteralResult.cpp Stylesheet.cpp
  Log:
  Replaced literal string with existing constant.
  
  Revision  Changes    Path
  1.8       +10 -8     xml-xalan/c/src/DOMSupport/DOMServices.cpp
  
  Index: DOMServices.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMServices.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOMServices.cpp   2000/04/14 19:56:37     1.7
  +++ DOMServices.cpp   2000/04/18 15:30:29     1.8
  @@ -70,7 +70,6 @@
   
   
   
  -//#include <Include/DOMHelper.hpp>
   #include <PlatformSupport/DOMStringHelper.hpp>
   #include "DOMSupportException.hpp"
   
  @@ -78,11 +77,17 @@
   
   #if defined(XALAN_INLINE_INITIALIZATION)
   
  +const XalanDOMString DOMServices::s_XMLString;
   const XalanDOMString DOMServices::s_XMLNamespaceURI;
  +const XalanDOMString DOMServices::s_XMLNamespace;
  +const XalanDOMString DOMServices::s_XMLNamespaceWithSeparator;
   
   #else
   
  +const XalanDOMString 
DOMServices::s_XMLString(XALAN_STATIC_UCODE_STRING("xml"));
   const XalanDOMString 
DOMServices::s_XMLNamespaceURI(XALAN_STATIC_UCODE_STRING("http://www.w3.org/XML/1998/namespace";));
  +const XalanDOMString 
DOMServices::s_XMLNamespace(XALAN_STATIC_UCODE_STRING("xmlns"));
  +const XalanDOMString 
DOMServices::s_XMLNamespaceWithSeparator(XALAN_STATIC_UCODE_STRING("xmlns:"));
   
   #endif
   
  @@ -323,7 +328,7 @@
   {
        XalanDOMString theNamespace;
   
  -     if(equals(prefix, "xml") == true)
  +     if(equals(prefix, s_XMLString) == true)
        {
                theNamespace = s_XMLNamespaceURI;
        }
  @@ -350,15 +355,13 @@
   
                                        const XalanDOMString            aname = 
attr->getNodeName();
   
  -                                     const char* const       theXMLNS = 
"xmlns:";
  -
                                        const bool isPrefix =
                                                        equals(substring(aname,
                                                                                
         0,
  -                                                                             
         0 + strlen(theXMLNS)),
  -                                                                theXMLNS);
  +                                                                             
         length(s_XMLNamespaceWithSeparator)),
  +                                                                
s_XMLNamespaceWithSeparator);
   
  -                                     if (equals(aname, "xmlns") || isPrefix) 
  +                                     if (equals(aname, s_XMLNamespace) || 
isPrefix) 
                                        {
                                                const unsigned int      index = 
indexOf(aname,
                                                                                
                                        ':');
  @@ -610,4 +613,3 @@
   
        return isNodeAfterSibling;
   }
  -
  
  
  
  1.8       +6 -0      xml-xalan/c/src/DOMSupport/DOMServices.hpp
  
  Index: DOMServices.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMServices.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOMServices.hpp   2000/04/11 14:30:44     1.7
  +++ DOMServices.hpp   2000/04/18 15:30:32     1.8
  @@ -86,11 +86,17 @@
   
   #if defined(XALAN_INLINE_INITIALIZATION)
   
  +     static const XalanDOMString             
s_XMLString(XALAN_STATIC_UCODE_STRING("xml"));
        static const XalanDOMString             
s_XMLNamespaceURI(XALAN_STATIC_UCODE_STRING("http://www.w3.org/XML/1998/namespace";));
  +     static const XalanDOMString             
s_XMLNamespace(XALAN_STATIC_UCODE_STRING("xmlns"));
  +     static const XalanDOMString             
s_XMLNamespaceWithSeparator(XALAN_STATIC_UCODE_STRING("xmlns:"));
   
   #else
   
  +     static const XalanDOMString             s_XMLString;
        static const XalanDOMString             s_XMLNamespaceURI;
  +     static const XalanDOMString             s_XMLNamespace;
  +     static const XalanDOMString             s_XMLNamespaceWithSeparator;
   
   #endif
   
  
  
  
  1.6       +4 -10     xml-xalan/c/src/DOMSupport/NamespaceResolver.cpp
  
  Index: NamespaceResolver.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/NamespaceResolver.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- NamespaceResolver.cpp     2000/04/11 14:30:44     1.5
  +++ NamespaceResolver.cpp     2000/04/18 15:30:32     1.6
  @@ -101,12 +101,6 @@
   
   
   
  -static XalanDOMString        theXMLString(XALAN_STATIC_UCODE_STRING("xml"));
  -static XalanDOMString        
theXMLNSString(XALAN_STATIC_UCODE_STRING("xmlns"));
  -static XalanDOMString        
theXMLNSStringWithColon(XALAN_STATIC_UCODE_STRING("xmlns:"));
  -
  -
  -
   void
   NamespaceResolver::updateNamespace(
                        const XalanNode*        theNode,
  @@ -208,7 +202,7 @@
                bool    ancestorsHaveXMLNS = false;
                bool    nHasXMLNS = false;
   
  -             if(equals(prefix, theXMLString) == true)
  +             if(equals(prefix, DOMServices::s_XMLString) == true)
                {
                        namespaceOfPrefix = DOMServices::s_XMLNamespaceURI;
                }
  @@ -253,9 +247,9 @@
   
                                                        if(charAt(aname, 0) == 
'x')
                                                        {
  -                                                             bool isPrefix = 
startsWith(aname, theXMLNSStringWithColon);
  +                                                             bool isPrefix = 
startsWith(aname, DOMServices::s_XMLNamespaceWithSeparator);
                                                          
  -                                                             if 
(equals(aname, theXMLNSString) == true || isPrefix == true) 
  +                                                             if 
(equals(aname, DOMServices::s_XMLNamespace) == true || isPrefix == true) 
                                                                {
                                                                        
if(theLocalNode == parent)
                                                                        {
  @@ -266,7 +260,7 @@
                                                                        
ancestorsHaveXMLNS = true;
   
                                                                        const 
XalanDOMString    p = isPrefix == true ?
  -                                                                             
substring(aname, length(theXMLNSStringWithColon)) : XalanDOMString();
  +                                                                             
substring(aname, length(DOMServices::s_XMLNamespaceWithSeparator)) : 
XalanDOMString();
   
                                                                        if 
(equals(p, prefix) == true) 
                                                                        {
  
  
  
  1.13      +7 -3      xml-xalan/c/src/XMLSupport/FormatterToHTML.cpp
  
  Index: FormatterToHTML.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToHTML.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- FormatterToHTML.cpp       2000/04/13 16:09:59     1.12
  +++ FormatterToHTML.cpp       2000/04/18 15:30:35     1.13
  @@ -55,7 +55,7 @@
    * <http://www.apache.org/>.
    */
   /**
  - * $Id: FormatterToHTML.cpp,v 1.12 2000/04/13 16:09:59 jdonohue Exp $
  + * $Id: FormatterToHTML.cpp,v 1.13 2000/04/18 15:30:35 dbertoni Exp $
    * 
    * $State: Exp $
    * 
  @@ -82,6 +82,10 @@
   
   
   
  +#include <DOMSupport/DOMServices.hpp>
  +
  +
  +
   const FormatterToHTML::EmptiesSetType                                
FormatterToHTML::s_empties =
                                                
FormatterToHTML::createEmpties();
   
  @@ -565,8 +569,8 @@
   {
        try
        {
  -             if(!equals(name, XALAN_STATIC_UCODE_STRING("xmlns")) &&
  -                     !startsWith(name, XALAN_STATIC_UCODE_STRING("xmlns:")))
  +             if(!equals(name, DOMServices::s_XMLNamespace) &&
  +                     !startsWith(name, 
DOMServices::s_XMLNamespaceWithSeparator))
                {
                        XalanDOMString pval;
                        XalanDOMString aname = toLowerCase(name);
  
  
  
  1.8       +4 -4      xml-xalan/c/src/XPath/QName.cpp
  
  Index: QName.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/QName.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- QName.cpp 2000/04/11 14:46:10     1.7
  +++ QName.cpp 2000/04/18 15:30:39     1.8
  @@ -97,7 +97,7 @@
        if(indexOfNSSep < length(qname))
        {
                const XalanDOMString            prefix = substring(qname, 0, 
indexOfNSSep);
  -             if(::equals(prefix, XALAN_STATIC_UCODE_STRING("xmlns")))
  +             if(::equals(prefix, DOMServices::s_XMLNamespace))
                        return;
                m_namespace = getNamespaceForPrefix(namespaces, prefix);
                if(0 == length(m_namespace))
  @@ -165,12 +165,12 @@
        {
                const XalanDOMString    prefix = substring(qname, 0, 
indexOfNSSep);
   
  -             if(::equals(prefix, XALAN_STATIC_UCODE_STRING("xml")))
  +             if(::equals(prefix, DOMServices::s_XMLString))
                {
                        m_namespace = DOMServices::s_XMLNamespaceURI;
                }
                // The default namespace is not resolved.
  -             else if(::equals(prefix, XALAN_STATIC_UCODE_STRING("xmlns")))
  +             else if(::equals(prefix, DOMServices::s_XMLNamespace))
                {
                        return;
                }
  @@ -202,7 +202,7 @@
   {
        XalanDOMString  nsURI;
   
  -     if(::equals(prefix, XALAN_STATIC_UCODE_STRING("xml")))
  +     if(::equals(prefix, DOMServices::s_XMLString))
        {
                nsURI = DOMServices::s_XMLNamespaceURI;
        }
  
  
  
  1.6       +10 -6     xml-xalan/c/src/XPath/SimpleNodeLocator.cpp
  
  Index: SimpleNodeLocator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/SimpleNodeLocator.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SimpleNodeLocator.cpp     2000/04/11 14:46:11     1.5
  +++ SimpleNodeLocator.cpp     2000/04/18 15:30:40     1.6
  @@ -59,10 +59,6 @@
   
   
   
  -#include <PlatformSupport/DirectoryEnumerator.hpp>
  -
  -
  -
   #include <XalanDOM/XalanElement.hpp>
   #include <XalanDOM/XalanNamedNodeMap.hpp>
   #include <XalanDOM/XalanNode.hpp>
  @@ -70,6 +66,14 @@
   
   
   
  +#include <PlatformSupport/DirectoryEnumerator.hpp>
  +
  +
  +
  +#include <DOMSupport/DOMServices.hpp>
  +
  +
  +
   #include "FoundIndex.hpp"
   #include "NodeRefListBase.hpp"
   #include "XObject.hpp"
  @@ -1565,8 +1569,8 @@
                                                                const 
XalanDOMString    attrName =
                                                                        
context->getNodeName();
   
  -                                                             score = 
!(startsWith(attrName, "xmlns:") ||
  -                                                                             
  equals(attrName, "xmlns"))
  +                                                             score = 
!(startsWith(attrName, DOMServices::s_XMLNamespaceWithSeparator) ||
  +                                                                             
  equals(attrName, DOMServices::s_XMLNamespace))
                                                                                
? xpath.s_MatchScoreNodeTest : xpath.s_MatchScoreNone;
                                                        }
                                                        else
  
  
  
  1.5       +6 -2      xml-xalan/c/src/XSLT/ElemAttribute.cpp
  
  Index: ElemAttribute.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemAttribute.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ElemAttribute.cpp 2000/04/11 15:09:23     1.4
  +++ ElemAttribute.cpp 2000/04/18 15:30:44     1.5
  @@ -66,6 +66,10 @@
   
   
   
  +#include <DOMSupport/DOMServices.hpp>
  +
  +
  +
   #include "AVT.hpp"
   #include "Constants.hpp"
   #include "StylesheetConstructionContext.hpp"
  @@ -169,7 +173,7 @@
                                {
                                        prefix = 
executionContext.getUniqueNameSpaceValue();
   
  -                                     XalanDOMString nsDecl = 
XalanDOMString(XALAN_STATIC_UCODE_STRING("xmlns:")) + prefix;
  +                                     XalanDOMString nsDecl = 
XalanDOMString(DOMServices::s_XMLNamespaceWithSeparator) + prefix;
   
                                        
executionContext.addResultAttribute(nsDecl, attrNameSpace);
                                }
  @@ -186,7 +190,7 @@
                }
         // Note we are using original attribute name for these tests. 
                else if(!isEmpty(executionContext.getPendingElementName())
  -                             && !equals(origAttrName, 
XALAN_STATIC_UCODE_STRING("xmlns")))
  +                             && !equals(origAttrName, 
DOMServices::s_XMLNamespace))
                {
                        // make sure that if a prefix is specified on the 
attribute name, it is valid
                        indexOfNSSep = indexOf(origAttrName, ':');
  
  
  
  1.4       +5 -1      xml-xalan/c/src/XSLT/ElemElement.cpp
  
  Index: ElemElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemElement.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ElemElement.cpp   2000/04/11 15:09:23     1.3
  +++ ElemElement.cpp   2000/04/18 15:30:45     1.4
  @@ -62,6 +62,10 @@
   
   
   
  +#include <DOMSupport/DOMServices.hpp>
  +
  +
  +
   #include "AVT.hpp"
   #include "Constants.hpp"
   #include "StylesheetConstructionContext.hpp"
  @@ -157,7 +161,7 @@
                                        prefix = 
executionContext.getUniqueNameSpaceValue();
   
                                        const XalanDOMString    nsDecl =
  -                                             
XalanDOMString(XALAN_STATIC_UCODE_STRING("xmlns:")) + prefix;
  +                                             
DOMServices::s_XMLNamespaceWithSeparator + prefix;
   
                                        
executionContext.addResultAttribute(nsDecl, elemNameSpace);
                                }
  
  
  
  1.9       +8 -4      xml-xalan/c/src/XSLT/ElemLiteralResult.cpp
  
  Index: ElemLiteralResult.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ElemLiteralResult.cpp     2000/04/12 19:40:58     1.8
  +++ ElemLiteralResult.cpp     2000/04/18 15:30:46     1.9
  @@ -63,6 +63,7 @@
   
   
   #include <sax/AttributeList.hpp>
  +#include <sax/SAXException.hpp>
   
   
   
  @@ -70,7 +71,10 @@
   #include <PlatformSupport/STLHelper.hpp>
   
   
  -#include <sax/SAXException.hpp>
  +
  +#include <DOMSupport/DOMServices.hpp>
  +
  +
   
   #include "AVT.hpp"
   #include "Constants.hpp"
  @@ -114,7 +118,7 @@
                {
                        prefix = substring(aname, 0, indexOfNSSep);
   
  -                     if(!equals(prefix, XALAN_STATIC_UCODE_STRING("xmlns")))
  +                     if(!equals(prefix, DOMServices::s_XMLNamespace))
                        {
                                XalanDOMString  ns = 
getNamespaceForPrefix(prefix);
   
  @@ -218,8 +222,8 @@
                                XalanDOMString  prefix = hasPrefix ? 
ns.getPrefix() : XalanDOMString();
                                XalanDOMString  desturi = 
executionContext.getResultNamespaceForPrefix(prefix);
                                XalanDOMString  attrName = hasPrefix ? 
  -                                     
(XalanDOMString(XALAN_STATIC_UCODE_STRING("xmlns:")) + prefix) :
  -                                                     
XalanDOMString(XALAN_STATIC_UCODE_STRING("xmlns"));
  +                                     
DOMServices::s_XMLNamespaceWithSeparator + prefix :
  +                                                     
DOMServices::s_XMLNamespace;
   
                                XalanDOMString srcURI = ns.getURI();
   
  
  
  
  1.11      +5 -5      xml-xalan/c/src/XSLT/Stylesheet.cpp
  
  Index: Stylesheet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Stylesheet.cpp    2000/04/11 20:05:07     1.10
  +++ Stylesheet.cpp    2000/04/18 15:30:46     1.11
  @@ -286,11 +286,11 @@
                const XalanDOMChar* const       aname = atts.getName(i);
                const XalanDOMChar* const       value = atts.getValue(i);
   
  -             bool isPrefix = startsWith(aname, 
XALAN_STATIC_UCODE_STRING("xmlns:"));
  +             bool isPrefix = startsWith(aname, 
DOMServices::s_XMLNamespaceWithSeparator);
   
  -             if (equals(aname, XALAN_STATIC_UCODE_STRING("xmlns")) || 
isPrefix) 
  +             if (equals(aname, DOMServices::s_XMLNamespace) || isPrefix) 
                {
  -                     XalanDOMString p = isPrefix ? substring(aname,6) : 
XalanDOMString();
  +                     XalanDOMString p = isPrefix ? substring(aname, 6) : 
XalanDOMString();
   
                        namespaces.push_back(NameSpace(p, value));
                }
  @@ -317,8 +317,8 @@
                        int                                                     
/* which */,
                        StylesheetConstructionContext&  constructionContext) 
const
   {
  -     bool attrOK = equals(attrName, XALAN_STATIC_UCODE_STRING("xmlns")) ||
  -                                              startsWith(attrName, 
XALAN_STATIC_UCODE_STRING("xmlns:"));
  +     bool attrOK = equals(attrName, DOMServices::s_XMLNamespace) ||
  +                                              startsWith(attrName, 
DOMServices::s_XMLNamespaceWithSeparator);
   
        if(!attrOK)
        {
  
  
  

Reply via email to