IgnoreNamespaceDeclarations Property

Applies to TestComplete 15.63, last modified on April 10, 2024

Description

The IgnoreNamespaceDeclarations property specifies whether TestComplete will ignore namespace declarations when comparing XML documents with the Compare method of the XMLCheckpoint object. For instance, if the property is True, TestComplete will consider the following nodes as equal (the ignored parts are marked with blue):

XML

<myElement xmlns:ns1="http://www.mycompany.com/tmpl/ns1">Some value</myElement>
<myElement>Some value</myElement>

Note that TestComplete will only ignore namespace declarations. Other attributes will not be ignored.

Declaration

XMLCheckpointOptionsObj.IgnoreNamespaceDeclarations

Read-Write Property Boolean
XMLCheckpointOptionsObj An expression, variable or parameter that specifies a reference to an XMLCheckpointOptions object

Applies To

The property is applied to the following object:

Property Value

True, if TestComplete ignores namespace declarations during comparison, and False otherwise.

Remarks

The XMLCheckpointOptions object provides access to a copy of the element’s data. Changes made to the comparison settings via the IgnoreNamespaceDeclarations property will not be stored in the XMLCheckpoint element and will not be displayed in the XMLCheckpointOptions Element editor.

Example

The following example demonstrates how you can obtain the XMLCheckpointOtions object, set its IgnoreNamespaceDeclarations property value to True and compare XMLCheckpoint with the XML document.

JavaScript, JScript

function IgnoreNamespaceDeclarationsDemo()
{

  var XMLCheckpoint, XMLOptions, XMLDoc;
  // Obtains the XMLCheckpoint object.
  XMLCheckpoint = XML.MyXMLCheckpoint;
  // Obtains the XMLCheckpointOptions object.
  XMLOptions = XMLCheckpoint.Options;

  // Enables the IgnoreNamespaceDeclarations XML checkpoint option.
  XMLOptions.IgnoreNamespaceDeclarations = true;

  // Specifies the XML document path.
  XMLDoc = "D:\\Work Folder\\XMLFile.xml";
  // Compares MyXMLCheckpoint with the XML document.
  XMLCheckpoint.Compare(XMLDoc)

}

Python

def IgnoreNamespaceDeclarationsDemo():
  # Obtains the XMLCheckpoint object.
  XMLCheckpoint = XML.MyXMLCheckpoint
  # Obtains the XMLCheckpointOptions object.
  XMLOptions = XMLCheckpoint.Options
  # Enables the IgnoreNamespaceDeclarations XML checkpoint option.
  XMLOptions.IgnoreNamespaceDeclarations = True
  # Specifies the XML document path.
  XMLDoc = "D:\\Work Folder\\XMLFile.xml";
  # Compares MyXMLCheckpoint with the XML document.
  XMLCheckpoint.Compare(XMLDoc)

VBScript

Sub IgnoreNamespaceDeclarationsDemo
Dim XMLCheckpoint, XMLOptions, XMLDoc

  ' Obtains the XMLCheckpoint object.
  Set XMLCheckpoint = XML.MyXMLCheckpoint
  ' Obtains the XMLCheckpointOptions object.
  Set XMLOptions = XMLCheckpoint.Options

  ' Enables the IgnoreNamespaceDeclarations XML checkpoint option.
  XMLOptions.IgnoreNamespaceDeclarations = True

  ' Specifies the XML document path.
  XMLDoc = "D:\Work Folder\XMLFile.xml"
  ' Compares MyXMLCheckpoint with the XML document.
  XMLCheckpoint.Compare(XMLDoc)

End Sub

DelphiScript

procedure IgnoreNamespaceDeclarationsDemo();
var XMLCheckpoint, XMLOptions, XMLDoc;
begin

  // Obtains the XMLCheckpoint object.
  XMLCheckpoint := XML.MyXMLCheckpoint;
  // Obtains the XMLCheckpointOptions object.
  XMLOptions := XMLCheckpoint.Options;

  // Enables the IgnoreNamespaceDeclarations XML checkpoint option.
  XMLOptions.IgnoreNamespaceDeclarations := True;

  // Specifies the XML document path.
  XMLDoc: = 'D:\Work Folder\XMLFile.xml';
  // Compares MyXMLCheckpoint with the XML document.
  XMLCheckpoint.Compare(XMLDoc);

end;

C++Script, C#Script

function IgnoreNamespaceDeclarationsDemo()
{

  var XMLCheckpoint, XMLOptions, XMLDoc;
  // Obtains the XMLCheckpoint object.
  XMLCheckpoint = XML["MyXMLCheckpoint"];
  // Obtains the XMLCheckpointOptions object.
  XMLOptions = XMLCheckpoint["Options"];

  // Enables the IgnoreNamespaceDeclarations XML checkpoint option.
  XMLOptions["IgnoreNamespaceDeclarations"] = true;

  // Specifies the XML document path.
  XMLDoc = "D:\\Work Folder\\XMLFile.xml";
  // Compares MyXMLCheckpoint with the XML document.
  XMLCheckpoint["Compare"](XMLDoc)

}

See Also

About XML Collection
Creating XML Checkpoints
About XML Checkpoints

Highlight search results