XML Object

Applies to TestComplete 15.42, last modified on September 08, 2022

Description

The XML object provides a scripting interface to the elements of the Stores | XML collection in your project.

The names of the object properties coincide with the names of the collections elements (the properties have the same name as the element names displayed in the Project Explorer panel). Each property returns the XMLCheckpoint object that corresponds to the appropriate child element.

Using these objects, you can compare XML data. For more information, see XML Checkpoints.

Requirements

The object is available only if the project contains the Stores | XML collection.

Members

Example

The following example demonstrates how you can use the XML object to obtain the elements of the Stores | XML collection from script.

JavaScript, JScript

function XMLObject()
{
  var XMLElement1, XMLElement2;

  // Uses the appropriate property of the XML object, …
  // … to obtain the XMLCheckpoint1 object in script.
  XMLElement1 = XML.XMLCheckpoint1;

  // Uses the appropriate property of the XML object, …
  // … to obtain the XMLCheckpoint2 object in script.
  XMLElement2 = XML.XMLCheckpoint2;

  // Compares the contents of the XML checkpoints.
  XMLElement1.Compare(XMLElement2);

}

Python

def XMLObject():
  # Uses the appropriate property of the XML object, ... 
  # ... to obtain the XMLCheckpoint1 object in script. 
  XMLElement1 = XML.XMLCheckpoint1
  # Uses the appropriate property of the XML object, ...
  # ... to obtain the XMLCheckpoint2 object in script. 
  XMLElement2 = XML.XMLCheckpoint2
  # Compares the contents of the XML checkpoints. 
  XMLElement1.Compare(XMLElement2)

VBScript

Sub XMLObject
  Dim XMLElement1, XMLElement2

  ' Uses the appropriate property of the XML object, …
  ' … to obtain the XMLCheckpoint1 object in script.
  Set XMLElement1 = XML.XMLCheckpoint1

  ' Uses the appropriate property of the XML object, …
  ' … to obtain the XMLCheckpoint2 object in script.
  Set XMLElement2 = XML.XMLCheckpoint2

  ' Compares the contents of the XML checkpoints.
  XMLElement1.Compare(XMLElement2)

End Sub

DelphiScript

procedure XMLObject();
var XMLElement1, XMLElement2;

begin  // Uses the appropriate property of the XML object, …
  // … to obtain the XMLCheckpoint1 object in script.
  XMLElement1 := XML.XMLCheckpoint1;

  // Uses the appropriate property of the XML object, …
  // … to obtain the XMLCheckpoint2 object in script.
  XMLElement2 := XML.XMLCheckpoint2;

  // Compares the contents of the XML checkpoints.
  XMLElement1.Compare(XMLElement2);

end;

C++Script, C#Script

function XMLObject()
{
  var XMLElement1, XMLElement2;

  // Uses the appropriate property of the XML object, …
  // … to obtain the XMLCheckpoint1 object in script.
  XMLElement1 = XML["XMLCheckpoint1"];

  // Uses the appropriate property of the XML object, …
  // … to obtain the XMLCheckpoint2 object in script.
  XMLElement2 = XML["XMLCheckpoint2"];

  // Compares the contents of the XML checkpoints.
  XMLElement1["Compare"] (XMLElement2);

}

See Also

About XML Checkpoints
XMLCheckpoint Object

Highlight search results