public void testSetAttributeNodeNS1() throws Throwable {
  Document doc;
  Element element;
  Attr attribute1;
  Attr attribute2;
  Attr attrNode;
  String attrName;
  String attrNS;
  NamedNodeMap attributes;
  int length;
  doc=(Document)load("staff",builder);
  element=doc.createElementNS("http://www.w3.org/DOM/Test/Level2","new:element");
  attribute1=doc.createAttributeNS("http://www.w3.org/DOM/Test/att1","p1:att");
  attribute2=doc.createAttributeNS("http://www.w3.org/DOM/Test/att1","p2:att");
  attribute2.setValue("value2");
  element.setAttributeNodeNS(attribute1);
  element.setAttributeNodeNS(attribute2);
  attrNode=element.getAttributeNodeNS("http://www.w3.org/DOM/Test/att1","att");
  attrName=attrNode.getNodeName();
  attrNS=attrNode.getNamespaceURI();
  assertEquals("elementsetattributenodens01_attrName","p2:att",attrName);
  assertEquals("elementsetattributenodens01_attrNS","http://www.w3.org/DOM/Test/att1",attrNS);
  attributes=element.getAttributes();
  length=(int)attributes.getLength();
  assertEquals("length",1,length);
}

public void testSetAttributeNodeNS1 ( ) throws Throwable { Document doc ; Element element ; Attr attribute1 ; Attr attribute2 ; Attr attrNode ; String attrName ; String attrNS ; NamedNodeMap attributes ; int length ; doc = ( Document ) load ( "staff" , builder ) ; element = doc . createElementNS ( "http://www.w3.org/DOM/Test/Level2" , "new:element" ) ; attribute1 = doc . createAttributeNS ( "http://www.w3.org/DOM/Test/att1" , "p1:att" ) ; attribute2 = doc . createAttributeNS ( "http://www.w3.org/DOM/Test/att1" , "p2:att" ) ; attribute2 . setValue ( "value2" ) ; element . setAttributeNodeNS ( attribute1 ) ; element . setAttributeNodeNS ( attribute2 ) ; attrNode = element . getAttributeNodeNS ( "http://www.w3.org/DOM/Test/att1" , "att" ) ; attrName = attrNode . getNodeName ( ) ; attrNS = attrNode . getNamespaceURI ( ) ; assertEquals ( "elementsetattributenodens01_attrName" , "p2:att" , attrName ) ; assertEquals ( "elementsetattributenodens01_attrNS" , "http://www.w3.org/DOM/Test/att1" , attrNS ) ; attributes = element . getAttributes ( ) ; length = ( int ) attributes . getLength ( ) ; assertEquals ( "length" , 1 , length ) ; }
runs the test case .
