dbertoni    2004/01/16 17:08:06

  Modified:    c/src/xalanc/XalanSourceTree XalanSourceTreeDocument.cpp
                        XalanSourceTreeDocument.hpp
  Log:
  Changes for Bugzilla 26207.
  
  Revision  Changes    Path
  1.5       +70 -11    
xml-xalan/c/src/xalanc/XalanSourceTree/XalanSourceTreeDocument.cpp
  
  Index: XalanSourceTreeDocument.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/xalanc/XalanSourceTree/XalanSourceTreeDocument.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XalanSourceTreeDocument.cpp       6 Jan 2004 02:41:43 -0000       1.4
  +++ XalanSourceTreeDocument.cpp       17 Jan 2004 01:08:06 -0000      1.5
  @@ -643,7 +643,8 @@
                        const AttributeListType&        attrs,
                        size_t                                          
theStartIndex,
                        XalanSourceTreeElement*         theOwnerElement,
  -                     bool                                            
fCreateNamespaces)
  +                     bool                                            
fCreateNamespaces,
  +                     const PrefixResolver*           thePrefixResolver)
   {
        const unsigned int      theSAXAttributeCount = attrs.getLength();
   
  @@ -664,14 +665,59 @@
                                attrs.getValue(i);
                        assert(theValue != 0);
   
  -                     theAttributeVector[theStartIndex] =
  -                             m_attributeAllocator.create(
  -                                     m_namesStringPool.get(theName),
  -                                     m_valuesStringPool.get(theValue),
  -                                     theOwnerElement,
  -                                     m_nextIndexValue++);
  +                     if (thePrefixResolver == 0)
  +                     {
  +                             theAttributeVector[theStartIndex] =
  +                                     m_attributeAllocator.create(
  +                                             m_namesStringPool.get(theName),
  +                                             
m_valuesStringPool.get(theValue),
  +                                             theOwnerElement,
  +                                             m_nextIndexValue++);
   
  -                     assert(theAttributeVector[theStartIndex] != 0);
  +                             assert(theAttributeVector[theStartIndex] != 0);
  +                     }
  +                     else
  +                     {
  +                const XalanDOMChar*    theLocalName = 0;
  +
  +                             const XalanDOMString* const             
theNamespace =
  +                                     getNamespaceForPrefix(
  +                                                     theName,
  +                                                     *thePrefixResolver,
  +                                                     m_stringBuffer,
  +                                                     false,
  +                            &theLocalName);
  +
  +                             if (theNamespace == 0 || length(*theNamespace) 
== 0)
  +                             {
  +                                     // the prefix was returned by 
getNamespaceForPrefix()...
  +                                     assert(length(m_stringBuffer) == 0);
  +
  +                                     theAttributeVector[theStartIndex] =
  +                                             m_attributeAllocator.create(
  +                                                     
m_namesStringPool.get(theName),
  +                                                     
m_valuesStringPool.get(theValue),
  +                                                     theOwnerElement,
  +                                                     m_nextIndexValue++);
  +
  +                                     
assert(theAttributeVector[theStartIndex] != 0);
  +                             }
  +                             else
  +                             {
  +                    assert(theLocalName != 0);
  +
  +                                     theAttributeVector[theStartIndex] =
  +                                             m_attributeNSAllocator.create(
  +                                                             
m_namesStringPool.get(theName),
  +                                                             
m_namesStringPool.get(theLocalName),
  +                                                             
m_namesStringPool.get(*theNamespace),
  +                                                             // This is the 
prefix...
  +                                                             
m_namesStringPool.get(m_stringBuffer),
  +                                                             
m_valuesStringPool.get(theValue),
  +                                                             theOwnerElement,
  +                                                             
m_nextIndexValue++);
  +                             }
  +                     }
   
                        ++theStartIndex;
                }
  @@ -866,7 +912,8 @@
                                attrs,
                                theIndex,
                                theNewElement,
  -                             true);
  +                             true,
  +                &thePrefixResolver);
   
        // Now, create the attribute "nodes"...
        theIndex = createAttributes(
  @@ -874,7 +921,8 @@
                                attrs,
                                theIndex,
                                theNewElement,
  -                             false);
  +                             false,
  +                &thePrefixResolver);
   
        return theNewElement;
   }
  @@ -1114,7 +1162,8 @@
                        const XalanDOMChar*             theName,
                        const PrefixResolver&   thePrefixResolver,
                        XalanDOMString&                 thePrefix,
  -                     bool                                    fUseDefault)
  +                     bool                                    fUseDefault,
  +            const XalanDOMChar**    theLocalName)
   {
        const XalanDOMString::size_type         theLength = length(theName);
        const XalanDOMString::size_type         theColonIndex = 
indexOf(theName, XalanUnicode::charColon);
  @@ -1125,11 +1174,21 @@
                assign(thePrefix, theName, theColonIndex);
                assert(length(thePrefix) != 0);
   
  +        if (theLocalName != 0)
  +        {
  +            *theLocalName = theName + theColonIndex + 1;
  +        }
  +
                return thePrefixResolver.getNamespaceForPrefix(thePrefix);
        }
        else
        {
                clear(thePrefix);
  +
  +        if (theLocalName != 0)
  +        {
  +            *theLocalName = theName;
  +        }
   
                if (fUseDefault == false)
                {
  
  
  
  1.3       +4 -2      
xml-xalan/c/src/xalanc/XalanSourceTree/XalanSourceTreeDocument.hpp
  
  Index: XalanSourceTreeDocument.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/xalanc/XalanSourceTree/XalanSourceTreeDocument.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XalanSourceTreeDocument.hpp       6 Jan 2004 02:41:43 -0000       1.2
  +++ XalanSourceTreeDocument.hpp       17 Jan 2004 01:08:06 -0000      1.3
  @@ -496,7 +496,8 @@
                        const AttributeListType&        attrs,
                        size_t                                          
theStartIndex,
                        XalanSourceTreeElement*         theOwnerElement,
  -                     bool                                            
fCreateNamespaces);
  +                     bool                                            
fCreateNamespaces,
  +                     const PrefixResolver*           thePrefixResolver = 0);
   
        XalanSourceTreeElement*
        createElementNode(
  @@ -533,7 +534,8 @@
                        const XalanDOMChar*             theName,
                        const PrefixResolver&   thePrefixResolver,
                        XalanDOMString&                 thePrefix,
  -                     bool                                    fUseDefault);
  +                     bool                                    fUseDefault,
  +            const XalanDOMChar**    theLocalName = 0);
   
        // Not implemented...
        XalanSourceTreeDocument(const XalanSourceTreeDocument&  theSource);
  
  
  

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

Reply via email to