Hi,
I have a problem.
I need to read some data from a text file and need to put it into XML file using VB6.

I have the follwoing input from the text file:

Suite id="ADD"
description="Add Validation Suite"
TestCase id="ATC_V_Add001"
and so on..........

and I want the following format in XML file. I have to update the XML file with the following info:

<?xml-stylesheet type="text/xsl" href="TestSuite.xsl"?>
<LLD>
<Cycle>
<Suite id="ADD" description="Add Validation Suite">
<TestCase id="ATC_V_Add001" description="Verify the Rulecode ADD001 with Address Overlap in the same Zone or City exception">
<LinkPVID>54221487</LinkPVID>

<Results>Exception ADD001 is generated see details in Exception info section</Results>

<StepTable id="StartUpApplication" description="To launch the application" />

</TestCase>
</Suite>
</Cycle>
</LLD>

Hi,
Could you tell me how to select a node having a attribute. In the example

<Suite id="ADD" description="Add Validation Suite">
How to select the Suite node using the "id' value.

Thanks,
karthik

This Code select the ID Node. Save your xml in C:\Test.xml or Change the Name in Load () function.
I am not correct exactly. but it will do.

Dim xDOM As DOMDocument
   Set xDOM = New DOMDocument
   
   Dim xRoot As IXMLDOMElement
   Dim xNodeList As IXMLDOMNodeList
   Dim xNM As IXMLDOMNamedNodeMap
   Dim xID As IXMLDOMNode
   xDOM.Load "c:\test.xml"  ' Or your File Name
   
   Set xRoot = xDOM.documentElement
   Set xNodeList = xRoot.getElementsByTagName("Suite")
   
   If (Not xNodeList Is Nothing) Then
      Set xNM = xNodeList(0).Attributes
      Set xID = xNM.getNamedItem("id")
      MsgBox iM.Text
   End If

Sorry, i forgot to mention my exact requirement
i need to select the node with the value of id

Eg:To select the "Suite" node with "id "value="ADD" and need to add some more node under it

Thanks,
Karthik

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.