? serialize.patch
Index: BaseMarkupSerializer.java
===================================================================
RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xml/serialize/BaseMarkupSerializer.java,v
retrieving revision 1.26
diff -u -r1.26 BaseMarkupSerializer.java
--- BaseMarkupSerializer.java	2001/07/11 15:40:10	1.26
+++ BaseMarkupSerializer.java	2001/07/23 18:12:10
@@ -547,7 +547,7 @@
     }
 
 
-    public final void processingInstruction( String target, String code )
+    public void processingInstruction( String target, String code )
         throws SAXException
     {
         try {
@@ -789,7 +789,7 @@
     //------------------------------------------//
 
 
-    public final void startDTD( String name, String publicId, String systemId )
+    public void startDTD( String name, String publicId, String systemId )
         throws SAXException
     {
         try {
Index: ElementState.java
===================================================================
RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xml/serialize/ElementState.java,v
retrieving revision 1.8
diff -u -r1.8 ElementState.java
--- ElementState.java	2001/07/20 20:37:06	1.8
+++ ElementState.java	2001/07/23 18:12:10
@@ -77,70 +77,70 @@
     /**
      * The element's raw tag name (local or prefix:local).
      */
-    String rawName;
+    public String rawName;
 
 
     /**
      * The element's local tag name.
      */
-    String localName;
+    public String localName;
 
 
     /**
      * The element's namespace URI.
      */
-    String namespaceURI;
+    public String namespaceURI;
 
 
     /**
      * True if element is space preserving.
      */
-    boolean preserveSpace;
+    public boolean preserveSpace;
 
 
     /**
      * True if element is empty. Turns false immediately
      * after serializing the first contents of the element.
      */
-    boolean empty;
+    public boolean empty;
 
 
     /**
      * True if the last serialized node was an element node.
      */
-    boolean afterElement;
+    public boolean afterElement;
 
 
     /**
      * True if the last serialized node was a comment node.
      */
-    boolean afterComment;
+    public boolean afterComment;
 
 
     /**
      * True if textual content of current element should be
      * serialized as CDATA section.
      */
-    boolean doCData;
+    public boolean doCData;
 
 
     /**
      * True if textual content of current element should be
      * serialized as raw characters (unescaped).
      */
-    boolean unescaped;
+    public boolean unescaped;
 
 
     /**
      * True while inside CData and printing text as CData.
      */
-    boolean inCData;
+    public boolean inCData;
 
 
     /**
      * Association between namespace URIs (keys) and prefixes (values).
      */
-    Hashtable prefixes;
+    public Hashtable prefixes;
 
 
 }
Index: Encodings.java
===================================================================
RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xml/serialize/Encodings.java,v
retrieving revision 1.4
diff -u -r1.4 Encodings.java
--- Encodings.java	2001/07/20 20:37:06	1.4
+++ Encodings.java	2001/07/23 18:12:10
@@ -81,12 +81,12 @@
     /**
      * The last printable character for unknown encodings.
      */
-    static final int DefaultLastPrintable = 0x7F;
+    public static final int DefaultLastPrintable = 0x7F;
 
     /**
      * @param encoding a MIME charset name, or null.
      */
-    static EncodingInfo getEncodingInfo(String encoding) {
+    public static EncodingInfo getEncodingInfo(String encoding) {
         if (encoding == null)
             return new EncodingInfo(null, DefaultLastPrintable);
         for (int i = 0;  i < _encodings.length;  i++) {
@@ -96,7 +96,7 @@
         return new SieveEncodingInfo(encoding, DefaultLastPrintable);
     }
 
-    static final String JIS_DANGER_CHARS
+    public static final String JIS_DANGER_CHARS
     = "\\\u007e\u007f\u00a2\u00a3\u00a5\u00ac"
     +"\u2014\u2015\u2016\u2026\u203e\u203e\u2225\u222f\u301c"
     +"\uff3c\uff5e\uffe0\uffe1\uffe2\uffe3";
Index: XMLSerializer.java
===================================================================
RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xml/serialize/XMLSerializer.java,v
retrieving revision 1.22
diff -u -r1.22 XMLSerializer.java
--- XMLSerializer.java	2001/06/11 20:08:26	1.22
+++ XMLSerializer.java	2001/07/23 18:12:11
@@ -733,7 +733,7 @@
         int            length;
 
         length = attrs.getLength();
-        attrsOnly = new AttributesImpl( attrs );
+        attrsOnly = attrs; // don't construct new AttributesImpl until we know we need to
 
         for ( i = length - 1 ; i >= 0 ; --i ) {
             rawName = attrsOnly.getQName( i );
@@ -752,6 +752,9 @@
 
                 startPrefixMapping( prefix, attrs.getValue( i ) );
                 //Remove it
+                if(attrsOnly == attrs) {
+                    attrsOnly = new AttributesImpl(attrs);
+                }
                 attrsOnly.removeAttribute( i );
             }
         }
