The Stores > XML collection contains XMLCheckpoint elements. XMLCheckpoint elements are used to compare and verify XML documents. They store XML data and comparison settings. You can modify the elements’ data using the editor or by writing script code or keyword test.
|Note:||If you need to automatically update all data stored in the XMLCheckpoint element, see Updating Elements of the XML Collection.|
Modifying Data in the Editor
You can view and modify an element’s data using the XMLCheckpoint Element editor.
The Tree View page of the editor displays stored data in a tree form. You can modify tree nodes using in-place editors and toolbar items. On the Source page of the editor you can modify the XML source code.
The XMLCheckpoint editor also lets you change comparison settings. For complete information on working with the editor, see About XMLCheckpoint Element Editor.
Modifying Data From Tests
To get scripting access to elements of the XML collection, use the
XML object. This object contains properties whose names coincide with the names of the collection’s elements and that return
XMLCheckpoint objects. Use properties of the object to access and modify stored XML data and comparison settings.
Document property of the
XMLCheckpoint object returns an object implementing the
IXMLDOMDocument interface (defined in Microsoft XML DOM). This object provides a scripting interface to the stored XML data and lets you read and modify values of stored nodes and attributes, change the nodes’ order, add new nodes and perform other tasks.
For instance, the following code demonstrates how you can load data from a file to a stored XMLCheckpoint element called XmlCheckpoint1:
Log.Message("Loaded data", XML.XmlCheckpoint1.Document.xml);
XML.XmlCheckpoint1.Document.load("c:\\MyFile.xml") Log.Message("Loaded data", XML.XmlCheckpoint1.Document.xml)
Call Log.Message("Loaded data", XML.XmlCheckpoint1.Document.xml)
Log.Message('Loaded data', XML.XmlCheckpoint1.Document.xml);
Log["Message"]("Loaded data", XML["XmlCheckpoint1"]["Document"]["xml"]);
For complete information on
IXMLDOMDocument, its methods and properties and for information on other Microsoft XML DOM objects, see the XML Core Services and Document Object Model article in the MSDN Library.
To obtain scripting access to the comparison settings of an XMLCheckpoint element, use the
Options property of the
XMLCheckpoint object. This property returns the
XMLCheckpointOptions object, which has properties that provide access to the appropriate comparison settings:
IgnoreAttributes- Provides access to the “Ignore attributes” setting.
IgnoreNamespaceDeclarations- Provides access to the “Ignore namespace declarations” setting.
IgnoreNodeOrder- Provides access to the “Ignore node order” setting.
IgnorePrefixes- Provides access to the “Ignore prefixes” setting.
CompareInSubTreeMode- Provides access to the “Compare in subtree mode” setting.
ExtendedLogging- Provides access to the “Extended logging” setting.
You can use the
XMLCheckpoint objects and their methods and properties in keyword tests by using the Call Object Method or Run Code Snippet operation.