mrglavas    2004/08/13 12:15:30

  Modified:    java/src/org/apache/xerces/xinclude XIncludeHandler.java
  Log:
  Fixing a number of bugs regarding namespace fixup:

  

  1) When adding an attribute for the default namespace

  we were reporting that the prefix was 'xmlns' instead of null.

  

  2) When adding a namespace declaration which unbinds

  a namespace we were reporting null as the value of this

  attribute instead of the empty string.

  

  3) Start and end prefix mappings were not being reported

  in SAX because the prefix was not being declared in the

  current context.
  
  Revision  Changes    Path
  1.33      +22 -9     
xml-xerces/java/src/org/apache/xerces/xinclude/XIncludeHandler.java
  
  Index: XIncludeHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/xinclude/XIncludeHandler.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- XIncludeHandler.java      13 Aug 2004 15:46:36 -0000      1.32
  +++ XIncludeHandler.java      13 Aug 2004 19:15:30 -0000      1.33
  @@ -1700,12 +1700,19 @@
                               }
   
                               QName ns = (QName)NEW_NS_ATTR_QNAME.clone();
  +                            ns.prefix = null;
                               ns.localpart = XMLSymbols.PREFIX_XMLNS;
                               ns.rawname = XMLSymbols.PREFIX_XMLNS;
  -                            attributes.addAttribute(
  -                                ns,
  -                                XMLSymbols.fCDATASymbol,
  -                                uri);
  +                            int index = 
  +                                attributes.addAttribute(
  +                                    ns,
  +                                    XMLSymbols.fCDATASymbol,
  +                                    uri != null ? uri : XMLSymbols.EMPTY_STRING);
  +                            attributes.setSpecified(index, true);
  +                            // Need to re-declare this prefix in the current context
  +                            // in order for the SAX parser to report the appropriate
  +                            // start and end prefix mapping events. -- mrglavas
  +                            fNamespaceContext.declarePrefix(prefix, uri);
                           }
                       }
                       else if (
  @@ -1721,10 +1728,16 @@
                           ns.rawname = (fSymbolTable != null) ? 
                               fSymbolTable.addSymbol(ns.rawname) :
                               ns.rawname.intern();
  -                        attributes.addAttribute(
  -                            ns,
  -                            XMLSymbols.fCDATASymbol,
  -                            uri);
  +                        int index =
  +                            attributes.addAttribute(
  +                                ns,
  +                                XMLSymbols.fCDATASymbol,
  +                                uri != null ? uri : XMLSymbols.EMPTY_STRING);
  +                        attributes.setSpecified(index, true);
  +                        // Need to re-declare this prefix in the current context
  +                        // in order for the SAX parser to report the appropriate 
  +                        // start and end prefix mapping events. -- mrglavas
  +                        fNamespaceContext.declarePrefix(prefix, uri);
                       }
                   }
               }
  
  
  

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

Reply via email to