public void test_XMLNode_attribute_add_remove()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLNode node = new XMLNode(triple,attr);
       XMLTriple xt1 = new  XMLTriple("name1", "http://name1.org/", "p1");
       XMLTriple xt2 = new  XMLTriple("name2", "http://name2.org/", "p2");
       XMLTriple xt3 = new  XMLTriple("name3", "http://name3.org/", "p3");
       XMLTriple xt1a = new  XMLTriple("name1", "http://name1a.org/", "p1a");
       XMLTriple xt2a = new  XMLTriple("name2", "http://name2a.org/", "p2a");
       node.addAttr( "name1", "val1", "http://name1.org/", "p1");
       node.addAttr(xt2, "val2");
       assertTrue( node.getAttributesLength() == 2 );
       assertTrue( node.isAttributesEmpty() == false );
       assertTrue( (  "name1" != node.getAttrName(0) ) == false );
       assertTrue( (  "val1"  != node.getAttrValue(0) ) == false );
       assertTrue( (  "http://name1.org/" != node.getAttrURI(0) ) == false );
       assertTrue( (  "p1"    != node.getAttrPrefix(0) ) == false );
       assertTrue( (  "name2" != node.getAttrName(1) ) == false );
       assertTrue( (  "val2"  != node.getAttrValue(1) ) == false );
       assertTrue( (  "http://name2.org/" != node.getAttrURI(1) ) == false );
       assertTrue( (  "p2"    != node.getAttrPrefix(1) ) == false );
       assertTrue( node.getAttrValue( "name1") == "" );
       assertTrue( node.getAttrValue( "name2") == "" );
       assertTrue( (  "val1"  != node.getAttrValue( "name1", "http://name1.org/") ) == false );
       assertTrue( (  "val2"  != node.getAttrValue( "name2", "http://name2.org/") ) == false );
       assertTrue( (  "val1"  != node.getAttrValue(xt1) ) == false );
       assertTrue( (  "val2"  != node.getAttrValue(xt2) ) == false );
       assertTrue( node.hasAttr(-1) == false );
       assertTrue( node.hasAttr(2) == false );
       assertTrue( node.hasAttr(0) == true );
       assertTrue( node.hasAttr( "name1", "http://name1.org/") == true );
       assertTrue( node.hasAttr( "name2", "http://name2.org/") == true );
       assertTrue( node.hasAttr( "name3", "http://name3.org/") == false );
       assertTrue( node.hasAttr(xt1) == true );
       assertTrue( node.hasAttr(xt2) == true );
       assertTrue( node.hasAttr(xt3) == false );
       node.addAttr( "noprefix", "val3");
       assertTrue( node.getAttributesLength() == 3 );
       assertTrue( node.isAttributesEmpty() == false );
       assertTrue( (  "noprefix" != node.getAttrName(2) ) == false );
       assertTrue( (  "val3"     != node.getAttrValue(2) ) == false );
       assertTrue( node.getAttrURI(2) == "" );
       assertTrue( node.getAttrPrefix(2) == "" );
       assertTrue( (      "val3"  != node.getAttrValue( "noprefix") ) == false );
       assertTrue( (  "val3"  != node.getAttrValue( "noprefix", "") ) == false );
       assertTrue( node.hasAttr( "noprefix"    ) == true );
       assertTrue( node.hasAttr( "noprefix", "") == true );
       node.addAttr(xt1, "mval1");
       node.addAttr( "name2", "mval2", "http://name2.org/", "p2");
       assertTrue( node.getAttributesLength() == 3 );
       assertTrue( node.isAttributesEmpty() == false );
       assertTrue( (  "name1" != node.getAttrName(0) ) == false );
       assertTrue( (  "mval1" != node.getAttrValue(0) ) == false );
       assertTrue( (  "http://name1.org/" != node.getAttrURI(0) ) == false );
       assertTrue( (  "p1"    != node.getAttrPrefix(0) ) == false );
       assertTrue( (  "name2"    != node.getAttrName(1) ) == false );
       assertTrue( (  "mval2"    != node.getAttrValue(1) ) == false );
       assertTrue( (  "http://name2.org/" != node.getAttrURI(1) ) == false );
       assertTrue( (  "p2"       != node.getAttrPrefix(1) ) == false );
       assertTrue( node.hasAttr(xt1) == true );
       assertTrue( node.hasAttr( "name1", "http://name1.org/") == true );
       node.addAttr( "noprefix", "mval3");
       assertTrue( node.getAttributesLength() == 3 );
       assertTrue( node.isAttributesEmpty() == false );
       assertTrue( (  "noprefix" != node.getAttrName(2) ) == false );
       assertTrue( (  "mval3"    != node.getAttrValue(2) ) == false );
       assertTrue( node.getAttrURI(2) == "" );
       assertTrue( node.getAttrPrefix(2) == "" );
       assertTrue( node.hasAttr( "noprefix") == true );
       assertTrue( node.hasAttr( "noprefix", "") == true );
       node.addAttr(xt1a, "val1a");
       node.addAttr(xt2a, "val2a");
       assertTrue( node.getAttributesLength() == 5 );
       assertTrue( (  "name1" != node.getAttrName(3) ) == false );
       assertTrue( (  "val1a" != node.getAttrValue(3) ) == false );
       assertTrue( (  "http://name1a.org/" != node.getAttrURI(3) ) == false );
       assertTrue( (  "p1a" != node.getAttrPrefix(3) ) == false );
       assertTrue( (  "name2" != node.getAttrName(4) ) == false );
       assertTrue( (  "val2a" != node.getAttrValue(4) ) == false );
       assertTrue( (  "http://name2a.org/" != node.getAttrURI(4) ) == false );
       assertTrue( (  "p2a" != node.getAttrPrefix(4) ) == false );
       assertTrue( (  "val1a"  != node.getAttrValue( "name1", "http://name1a.org/") ) == false );
       assertTrue( (  "val2a"  != node.getAttrValue( "name2", "http://name2a.org/") ) == false );
       assertTrue( (  "val1a"  != node.getAttrValue(xt1a) ) == false );
       assertTrue( (  "val2a"  != node.getAttrValue(xt2a) ) == false );
       node.removeAttr(xt1a);
       node.removeAttr(xt2a);
       assertTrue( node.getAttributesLength() == 3 );
       node.removeAttr( "name1", "http://name1.org/");
       assertTrue( node.getAttributesLength() == 2 );
       assertTrue( node.isAttributesEmpty() == false );
       assertTrue( (  "name2" != node.getAttrName(0) ) == false );
       assertTrue( (  "mval2" != node.getAttrValue(0) ) == false );
       assertTrue( (  "http://name2.org/" != node.getAttrURI(0) ) == false );
       assertTrue( (  "p2" != node.getAttrPrefix(0) ) == false );
       assertTrue( (  "noprefix" != node.getAttrName(1) ) == false );
       assertTrue( (  "mval3" != node.getAttrValue(1) ) == false );
       assertTrue( node.getAttrURI(1) == "" );
       assertTrue( node.getAttrPrefix(1) == "" );
       assertTrue( node.hasAttr( "name1", "http://name1.org/") == false );
       node.removeAttr(xt2);
       assertTrue( node.getAttributesLength() == 1 );
       assertTrue( node.isAttributesEmpty() == false );
       assertTrue( (  "noprefix" != node.getAttrName(0) ) == false );
       assertTrue( (  "mval3" != node.getAttrValue(0) ) == false );
       assertTrue( node.getAttrURI(0) == "" );
       assertTrue( node.getAttrPrefix(0) == "" );
       assertTrue( node.hasAttr(xt2) == false );
       assertTrue( node.hasAttr( "name2", "http://name2.org/") == false );
       node.removeAttr( "noprefix");
       assertTrue( node.getAttributesLength() == 0 );
       assertTrue( node.isAttributesEmpty() == true );
       assertTrue( node.hasAttr( "noprefix"    ) == false );
       assertTrue( node.hasAttr( "noprefix", "") == false );
       node = null;
       xt1 = null;
       xt2 = null;
       xt3 = null;
       xt1a = null;
       xt2a = null;
       triple = null;
       attr = null;
 }
 public void test_XMLNode_attribute_set_clear()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLNode node = new XMLNode(triple,attr);
       XMLAttributes nattr = new  XMLAttributes();
       XMLTriple xt1 = new  XMLTriple("name1", "http://name1.org/", "p1");
       XMLTriple xt2 = new  XMLTriple("name2", "http://name2.org/", "p2");
       XMLTriple xt3 = new  XMLTriple("name3", "http://name3.org/", "p3");
       XMLTriple xt4 = new  XMLTriple("name4", "http://name4.org/", "p4");
       XMLTriple xt5 = new  XMLTriple("name5", "http://name5.org/", "p5");
       nattr.add(xt1, "val1");
       nattr.add(xt2, "val2");
       nattr.add(xt3, "val3");
       nattr.add(xt4, "val4");
       nattr.add(xt5, "val5");
       node.setAttributes(nattr);
       assertTrue( node.getAttributesLength() == 5 );
       assertTrue( node.isAttributesEmpty() == false );
       assertTrue( (  "name1" != node.getAttrName(0) ) == false );
       assertTrue( (  "val1"  != node.getAttrValue(0) ) == false );
       assertTrue( (  "http://name1.org/" != node.getAttrURI(0) ) == false );
       assertTrue( (  "p1"    != node.getAttrPrefix(0) ) == false );
       assertTrue( (  "name2" != node.getAttrName(1) ) == false );
       assertTrue( (  "val2"  != node.getAttrValue(1) ) == false );
       assertTrue( (  "http://name2.org/" != node.getAttrURI(1) ) == false );
       assertTrue( (  "p2"    != node.getAttrPrefix(1) ) == false );
       assertTrue( (  "name3" != node.getAttrName(2) ) == false );
       assertTrue( (  "val3"  != node.getAttrValue(2) ) == false );
       assertTrue( (  "http://name3.org/" != node.getAttrURI(2) ) == false );
       assertTrue( (  "p3"    != node.getAttrPrefix(2) ) == false );
       assertTrue( (  "name4" != node.getAttrName(3) ) == false );
       assertTrue( (  "val4"  != node.getAttrValue(3) ) == false );
       assertTrue( (  "http://name4.org/" != node.getAttrURI(3) ) == false );
       assertTrue( (  "p4"    != node.getAttrPrefix(3) ) == false );
       assertTrue( (  "name5" != node.getAttrName(4) ) == false );
       assertTrue( (  "val5"  != node.getAttrValue(4) ) == false );
       assertTrue( (  "http://name5.org/" != node.getAttrURI(4) ) == false );
       assertTrue( (  "p5"    != node.getAttrPrefix(4) ) == false );
       XMLTriple ntriple = new  XMLTriple("test2","http://test2.org/","p2");
       node.setTriple(ntriple);
       assertTrue( (    "test2" != node.getName() ) == false );
       assertTrue( (     "http://test2.org/" != node.getURI() ) == false );
       assertTrue( (  "p2" != node.getPrefix() ) == false );
       node.clearAttributes();
       assertTrue( node.getAttributesLength() == 0 );
       assertTrue( node.isAttributesEmpty() != false );
       triple = null;
       ntriple = null;
       node = null;
       attr = null;
       nattr = null;
       xt1 = null;
       xt2 = null;
       xt3 = null;
       xt4 = null;
       xt5 = null;
 }