clone() public method

public clone ( ) : XMLNode
return XMLNode
Ejemplo n.º 1
0
 public void test_Node_clone()
 {
     XMLAttributes att = new XMLAttributes();
       XMLTriple t = new XMLTriple("sarah", "http://foo.org/", "bar");
       XMLToken token = new XMLToken(t,att,3,4);
       XMLNode node = new XMLNode(token);
       XMLNode child = new XMLNode();
       node.addChild(child);
       assertTrue( node.getNumChildren() == 1 );
       assertTrue( node.getName() ==  "sarah" );
       assertTrue( node.getURI() ==  "http://foo.org/" );
       assertTrue( node.getPrefix() ==  "bar" );
       assertTrue( node.isEnd() == false );
       assertTrue( node.isEOF() == false );
       assertTrue( node.getLine() == 3 );
       assertTrue( node.getColumn() == 4 );
       XMLNode node2 = (XMLNode) node.clone();
       assertTrue( node2.getNumChildren() == 1 );
       assertTrue( node2.getName() ==  "sarah" );
       assertTrue( node2.getURI() ==  "http://foo.org/" );
       assertTrue( node2.getPrefix() ==  "bar" );
       assertTrue( node2.isEnd() == false );
       assertTrue( node2.isEOF() == false );
       assertTrue( node2.getLine() == 3 );
       assertTrue( node2.getColumn() == 4 );
       t = null;
       token = null;
       node = null;
       node2 = null;
 }