Micro Focus QTP (UFT) Forums
Read and Write data to XML - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Read and Write data to XML (/Thread-Read-and-Write-data-to-XML)



Read and Write data to XML - kamalteja - 04-10-2008

Hi,

I want to know how to read and write data to XML, if possible create additional tags in XML.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<template>
  <abc version="1.5"/>
  <name key="key.1"/>
  <version>1.5</version>
  <description key="key.13"/>
  <supportedLocale>EN</supportedLocale>
  <defaultLocale>EN</defaultLocale>
  <minimumPassingScore>50</minimumPassingScore>
  <section>
    <name key="key.2"/>
    <description key="key.12"/>
    <order>0</order>
    <minimumPassingScore>100</minimumPassingScore>
    <requiresAudit>false</requiresAudit>
    <weight>100</weight>
    <question>
      <text key="key.3"/>
      <order>1</order>
      <type>exclusive</type>
      <weight>100</weight>
      <choice>
        <text key="key.4"/>
        <value>50</value>
      </choice>
    </question>
    <section>
      <name key="key.8"/>
      <description key="key.14"/>
      <order>2</order>
      <minimumPassingScore>100</minimumPassingScore>
      <requiresAudit>false</requiresAudit>
      <weight>100</weight>
      <question>
        <text key="key.9"/>
        <order>3</order>
        <type>binary</type>
        <weight>100</weight>
        <choice>
          <text key="key.10"/>
          <value>100</value>
        </choice>
      </question>
    </section>
  </section>
  <stringBundle>
    <localeBundle locale="EN">
      [b]<externalString keyref="key.1">Questionnaire Name</externalString>[/b]
      <externalString keyref="key.2">Test Section123</externalString>
    </localeBundle>
  </stringBundle>
</template>

Above is the my XML file, where i want to retrieve the content in
<externalString keyref="key.1">Questionnaire Name</externalString> i.e., the text "Questionnaire Name"

I want to know how to write data and to create additional XML tags if possible


RE: Read and Write data to XML - mag - 04-17-2008

Probably you can do this with CreateObject("Microsoft.XmlDom").