Archived Forum Post

Index of archived forum posts

Question:

how to parse multi tag XML

May 09 '15 at 14:19

I've been pulling my hair out trying to figure out how to parse the XML code below in VB6. I need to be able to reference the content by it's tag name. For example I need to be able to pluck the content by it's element name e.g. "Album" and have it return the content "Face Up in the Rain." Preferably without having to do any iteration. Example strAlbum = XML.someMethodByTagName("Album") I've been able to reference and obtain the content by using an index i.e. strAlbum = XML.GetChildContentByIndex(n), but I need to be able to use the tag name because the order and number of the elements might change. Also, please note there are two references to "Status" and one element named "Name."

 <Response Status="OK">
   <Item Name="ZoneID">0</Item>
   <Item Name="State">2</Item>
   <Item Name="FileKey">305718</Item>
   <Item Name="Artist">Michael Tomlinson</Item>
   <Item Name="Album">Face Up in the Rain</Item>
   <Item Name="Name">The Way We're Going</Item>
   <Item Name="Status">Playing</Item>
</response>

Any insight/help would be greatly appreciated.

p.s. I'm woking in VB6, not C.


Answer

Here's an example:

Android: XML GetChildWithAttr

C: XML GetChildWithAttr

C#: XML GetChildWithAttr

C# WinRT: XML GetChildWithAttr

C++: XML GetChildWithAttr

Classic ASP: XML GetChildWithAttr

DataFlex: XML GetChildWithAttr

Delphi ActiveX: XML GetChildWithAttr

Delphi DLL: XML GetChildWithAttr

Java: XML GetChildWithAttr

Lianja: XML GetChildWithAttr

MFC: XML GetChildWithAttr

Objective-C: XML GetChildWithAttr

Perl: XML GetChildWithAttr

PHP ActiveX: XML GetChildWithAttr

PHP Extension: XML GetChildWithAttr

PowerBuilder: XML GetChildWithAttr

PowerShell: XML GetChildWithAttr

PureBasic: XML GetChildWithAttr

Python: XML GetChildWithAttr

Ruby: XML GetChildWithAttr

SQL Server: XML GetChildWithAttr

Swift: XML GetChildWithAttr

Unicode C: XML GetChildWithAttr

Unicode C++: XML GetChildWithAttr

VB.NET: XML GetChildWithAttr

VB.NET WinRT: XML GetChildWithAttr

VBScript: XML GetChildWithAttr

Visual Basic 6.0: XML GetChildWithAttr

Visual FoxPro: XML GetChildWithAttr