Posted by Albert Gareev on May 15, 2014
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Filters parent XML object by removing child XML nodes not matching specified attribute regex value. Implementation Unit Tests ...
Posted by Albert Gareev on Apr 23, 2014
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Filters parent XML object by removing child XML nodes not matching specified attribute value. Implementation Unit Tests ...
Posted by Albert Gareev on Apr 15, 2014
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Returns child XML node with specified attribute matching specified regex. Implementation Unit Tests ...
Posted by Albert Gareev on Feb 10, 2014
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Append all child elements from the list (including their attributes, comments, text nodes) to XML node. Implementation Test Code ...
Posted by Albert Gareev on Sep 08, 2012
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Returns text value of node’s child attribute specified by name. Valid arguments: an XML element node (NODE_ELEMENT type), name of the attribute. If XML node is not defined, returns empty string. Uses private function p_GetXMLElementAttrText, defined within the library (see parent page). Implementation ...
Posted by Albert Gareev on Dec 08, 2011
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Copy all child elements (and attributes, comments, text nodes) from one XML node to another. Implementation Test Code ...
Posted by Albert Gareev on Dec 06, 2011
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Move all child elements (and attributes, comments, text nodes) from one XML node to another. Implementation Test Code ...
Posted by Albert Gareev on Oct 20, 2011
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Locate XML node depth within the hierarchy. Valid argument: an XML element node (NODE_ELEMENT type). Implementation ...
Posted by Albert Gareev on Oct 08, 2011
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Description Create XML DOM object by loading source XML from string. If the string is empty or source XML is invalid returns Nothing. Implementation Test Code ...
Posted by Albert Gareev on Jul 20, 2011
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Service Functions – Dictionary (QTP, TestComplete, VBScript) Description For each occurrence of XML node perform conversion to Dictionary, and store all records in indexed Dictionary object. Implementation ...
Posted by Albert Gareev on Jul 19, 2011
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript) Service Functions – Dictionary (QTP, TestComplete, VBScript) Description Create Dictionary object and populate with data (only direct content – text, comments, CData, and attributes) taken from XML node. Naming convention: @attr_name for attributes; #text_index for text nodes; #comment_index for comment nodes; #cdata_index for CData Section nodes. […] ...
Posted by Albert Gareev on Jun 23, 2011
Parent page: Generating Test Reports Today I put all examples together. Here’s our XML record simulating log data of a test session. XML Source The following line <?xml-stylesheet type=”text/xsl” href=”.\LogView4.xsl”?> instructs the web browser to use XSL script for visualization of XML data. Web-page Report And here’s the source code of the script XSL Source […] ...
Posted by Albert Gareev on May 25, 2011
Parent page: Generating Test Reports Let’s now take the examples from the previous post, and add more style. Here’s our XML record simulating log data of a test session. XML Source Did you notice the following line? <?xml-stylesheet type=”text/xsl” href=”.\LogView3.xsl”?> This is how we instruct the web browser to use XSL script for visualization of XML data. […] ...
Posted by Albert Gareev on Mar 14, 2011
Parent page: Generating Test Reports Today I continue with more complex examples using previously demonstrated XSL parsing nodes grouped into sub-templates. Here’s our XML record simulating log data of a test session. XML Source Note that the structure of XML file is not identical to the previous examples. It has more complexities and dependencies that need […] ...
Posted by Albert Gareev on Mar 04, 2011
Parent page: Generating Test Reports Today I present XML Tree to HTML Table transformation example. Here’s our XML record simulating logged test steps. XML Source Did you notice the following line? <?xml-stylesheet type=”text/xsl” href=”.\Tree2Table.xsl”?> This is how we instruct the web browser to use XSL script for visualization of XML data. Web-page Report And here’s […] ...
Posted by Albert Gareev on Mar 03, 2011
Parent page: Generating Test Reports Today I present example on dynamically building HTML nodes, with XSL, and from XML data. Here’s our XML record simulating log data of a test session. XML Source Did you notice the following line? <?xml-stylesheet type=”text/xsl” href=”.\LogView1.xsl”?> This is how we instruct the web browser to use XSL script for […] ...
Posted by Albert Gareev on Mar 02, 2011
Parent page: Generating Test Reports Today I present example of an HTML Table populated with XML data. Here’s our XML record simulating stats data of a test session. XML Source Did you notice the following line? <?xml-stylesheet type=”text/xsl” href=”.\StatsTable.xsl”?> This is how we instruct the web browser to use XSL script for visualization of XML […] ...
Posted by Albert Gareev on Dec 30, 2009
Parent page: Service Functions – XML (QTP, VBScript) Answers Description Open XML file – load into memory – locate target nodes – update (replace) values – save XML file (either under a new name or overwrite the original file). Search is performed by tag name (“target_node”). If you pass in a non-string parameter for .SetValue function, convert […] ...
Posted by Albert Gareev on Dec 29, 2009
Parent page: Service Functions – XML (QTP, VBScript) Answers 1. How to count all direct children? 2. How to count all direct children, specific name tag? 3. How to count all descendants? References Read more about XPath queries. ...
Posted by Albert Gareev on Dec 09, 2009
Parent page: Service Functions – System (QTP, VBScript) Description If you need to generate text file with values you don’t know ahead you may do it dynamically, by utilizing the function below. Make sure you designed template first. The current logic is oriented to executable text files generation, like Dexterity Macro or OS Shell batch files. Code lines are data-driven, […] ...
Posted by Albert Gareev on Dec 03, 2009
Root page: Service Functions – XML (QTP, VBScript) Parent page: XSL introduction and references Related post: Text File compare in “WDIFF” style (QTP, VBScript, XML, XSL) – Instructions and XSL script Sample task After line by line (and word by word) text file comparison has been performed, XML log was produced. Review the log, identify and report found issues. […] ...
Posted by Albert Gareev on Dec 02, 2009
Root page: Service Functions – XML (QTP, VBScript) Parent page: XSL introduction and references Sample task Verify “transactions” xml file consisting of 10-1000 records. Only “debit” or “credit” record names are valid. Any other entries must be located and reported. Additionally, identify and report all debit records with debit amount greater than 50.00 Sample XML As you can […] ...
Posted by Albert Gareev on Nov 30, 2009
Parent page: Service Functions – XML (QTP, VBScript) What is XSL? The Extensible Stylesheet Language. An XSL script is a set of transformation instructions used by an engine (often, web browser, but could be any other processing program as well) to produce a new document based on XML input document. The original document remains unchanged. The output document […] ...
Posted by Albert Gareev on Nov 23, 2009
Parent page: Service Functions – XML (QTP, VBScript) Note. Although there could be no “reusable function” that would construct XPath for you, I store current post under “XML Service Functions” category, as it’s closely related to it. XPath is fairly simple to learn and very powerful in use. You can use free XPath Designer Tool to validate […] ...
Posted by Albert Gareev on Nov 15, 2009
Parent page: Service Functions – XML (QTP, VBScript) Description This particular example demonstrates adding XSL call that contains instructions transforming XML tree to a web-page (HTML). Built-in QTP support for XML does not provide mapping for XML methods that operate special nodes, like Processing Instructions. It can be done through Microsoft XML DOM object. ...
Posted by Albert Gareev on Nov 14, 2009
Parent page: Service Functions – XML (QTP, VBScript) Description Uses .AddChildElementByName method to create a child XML node, then returns reference to the newly created object. If Parent XML node is not defined returns “Nothing”. ...
Posted by Albert Gareev on Oct 02, 2009
In the code examples I present I often refer to routine functions. In my framework I have specialized libraries to call from. In my blog I maintain the similar structure. Using built-in QTP-XML Objects and Functions Returns reference of XML Element Returns text value of XML Element Returns reference of XML Attribute Returns text value of […] ...
Posted by Albert Gareev on Jul 21, 2009
Parent page: Service Functions – XML (QTP, VBScript) Description Retrieves child comment node from comments collection and returns comment text as string. ...
Posted by Albert Gareev on Jul 17, 2009
Parent page: Service Functions – XML (QTP, VBScript) Description Returns scalar value of the XML child attribute specified by a name. Attribute name duplication within the same node is not allowed by XML rules. If there is no attribute with the name specified then “” (empty string) is returned. ...
Posted by Albert Gareev on Jul 16, 2009
Parent page: Service Functions – XML (QTP, VBScript) Description Returns XML child attribute (as XMLAttribute object reference) specified by a name. Attribute name duplication within the same node is not allowed by XML rules. If there is no attribute with the name specified then “Nothing” is returned. ...