elena       2002/12/30 17:37:38

  Modified:    java/tests/dom/ids Test.java
  Log:
  Add test for DOM Level 3 setID methods
  
  Revision  Changes    Path
  1.6       +28 -1     xml-xerces/java/tests/dom/ids/Test.java
  
  Index: Test.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/tests/dom/ids/Test.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Test.java 19 Jun 2002 01:58:25 -0000      1.5
  +++ Test.java 31 Dec 2002 01:37:38 -0000      1.6
  @@ -59,6 +59,8 @@
   
   import java.io.PrintWriter;
   
  +import org.apache.xerces.dom.AttrImpl;
  +import org.apache.xerces.dom.ElementImpl;
   import org.w3c.dom.*;
   
   import org.xml.sax.SAXException;
  @@ -164,6 +166,31 @@
   
           elem = doc.getElementById("id02");
           Assertion.assert(elem ==null, "elem by id '02'");
  +        
  +        ElementImpl person = (ElementImpl)doc.getElementsByTagNameNS(null, 
"person").item(0);
  +        person.removeAttribute("id");
  +        person.removeAttribute("id2");
  +        person.setAttributeNS(null, "idAttr", "eb0009");
  +        person.setIdAttribute("idAttr", true);
  +        
  +        elem = doc.getElementById("eb0009");
  +        Assertion.assert(elem !=null, "elem by id 'eb0009'");
  +       
  +        doc.getDocumentElement().removeChild(person);
  +        elem = doc.getElementById("eb0009");
  +        Assertion.assert(elem ==null, "element with id 'eb0009 removed'");
  +
  +        doc.getDocumentElement().appendChild(person);
  +        elem = doc.getElementById("eb0009");
  +        Assertion.assert(elem !=null, "elem by id 'eb0009'");
  +        AttrImpl attr = (AttrImpl)person.getAttributeNode("idAttr");
  +        Assertion.assert(attr.getIsId(), "attribute is id");
  +
  +        person.setIdAttribute("idAttr", false);
  +        elem = doc.getElementById("eb0009");
  +        Assertion.assert(elem ==null, "element with id 'eb0009 removed'");
  +        
  +        Assertion.assert(!attr.getIsId(), "attribute is not id");        
   
           System.out.println("done.");
   
  
  
  

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

Reply via email to