[jdom-commits] CVS update: jdom/src/java/org/jdom

jhunter at cvs.jdom.org jhunter at cvs.jdom.org
Thu Jun 28 17:53:49 PDT 2001


Date:	Friday June 29, 2001 @ 1:53
Author:	jhunter

Update of /home/cvspublic/jdom/src/java/org/jdom
In directory www.nmemonix.com:/tmp/cvs-serv9263

Modified Files:
	Element.java 
Log Message:
Fixed bug in the elt.setAttribute() logic where attributes in no namespace 
would not be replaced.  Thanks to stephan.segschneider at snellwilcox.com for
spotting the issue.

This code demonstrated the problem:

import java.io.*;
import java.util.*;
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;

public class TestSetAttribute {

  public static void main(String[] args) throws Exception {

    Element root = new Element("root");
    root.setAttribute("hello", "before");
    new XMLOutputter().output(root, System.out);
    System.out.println();

    root.setAttribute("hello", "after");
    new XMLOutputter().output(root, System.out);
    System.out.println();

    Namespace ns = Namespace.getNamespace("foo", "bar");

    root = new Element("root");
    root.setAttribute("hello", "before", ns);
    new XMLOutputter().output(root, System.out);
    System.out.println();

    root.setAttribute("hello", "after", ns);
    new XMLOutputter().output(root, System.out);
    System.out.println();
  }
}

-jh-

===================================================================
File: no file Element.java		Status: Needs Checkout

   Working revision:	1.95	Fri Jun 29 00:53:49 2001
   Repository revision:	1.95	/home/cvspublic/jdom/src/java/org/jdom/Element.java,v

   Existing Tags:
	jdom_1_0_b7_rc2          	(revision: 1.94)
	jdom_1_0_b7_rc1          	(revision: 1.92)
	jdom_1_0_b6              	(revision: 1.52)
	start                    	(revision: 1.1.1.1)
	jdom                     	(branch: 1.1.1)




More information about the jdom-commits mailing list