Zennolab.CommandCenter
ReplaceElement Method
See Also  Example Send Feedback
Zennolab.CommandCenter Namespace > Document Class : ReplaceElement Method
newElement

Type: Zennolab.CommandCenter.HtmlElement

The html element to replace all occurrences of oldElement.

oldElement

Type: Zennolab.CommandCenter.HtmlElement

The html element to be replaced.

All occurrences of a specified html element in the current document replace with another specified html element.

Syntax

C# 
public void ReplaceElement( 
   HtmlElement newElement,
   HtmlElement oldElement
)

Parameters

newElement

Type: Zennolab.CommandCenter.HtmlElement

The html element to replace all occurrences of oldElement.

oldElement

Type: Zennolab.CommandCenter.HtmlElement

The html element to be replaced.

Example

The following code example demonstrates ReplaceElement method. Also the following code uses InsertElement method.
C#Copy Code
Document doc = tab.MainDocument;
            
HtmlElement he1 = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
HtmlElement he2 = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByName("rad");
            
doc.InsertElement(he1);
doc.InsertElement(he2);
            
doc.ReplaceElement(he2, h1);
PHPCopy Code
$doc = $tab->MainDocument;
            
$he1 = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
$he2 = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByName("rad");
            
$doc->InsertElement($he1);
$doc->InsertElement($he2);
            
$doc->ReplaceElement($he2, $h1);

Remarks

The IsNull property be true if the html element does not belongs to any document.

Requirements

Target Platforms: Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2011 All Rights Reserved.