I'm using Gambas as my language.. :-)
Now I have a problem getting some values from an XML document.
I'm using xml.gb as my "plugin".
The XML document is:
"<ns1:Event>
<ns1:Number>1</ns1:Number>
<ns1:Name>Home Team - Away Team</ns1:Name>
<ns1:Status Id="100">End</ns1:Status>
<ns1:Results>
<ns1:Result Id="0" Name="Result">2</ns1:Result>
<ns1:Result Id="1" Name="Fulltime">2</ns1:Result>
<ns1:Result Id="2" Name="Halftime">0</ns1:Result>
</ns1:Results>
</ns1:Event>"
My code so far is:
Dim i As Integer
Dim iKampnr As Integer
Dim iRes As New Integer[]
Dim hXMLDocument As XmlDocument
Dim xeElements As XmlElement[]
Dim tempElements As XmlElement[]
Dim xeNode As XmlNode[]
Dim xsRecord As String[]
Dim sSplit As New String[]
Dim yData As New XMLNT
Dim rData As New XMLNT[]
Dim sTemp As String
Dim n as integer = -1
rData = New XMLNT[]
hXMLDocument = New XmlDocument
hXMLDocument.Open(sURL)
xeNode = New XmlNode[]
xeElements = New XmlElement[]
xeElements = hXMLDocument.GetElementsByTagName("ns1:Event")
xeNode = xeElements[0].AllChildNodes
xsRecord = New String[]
'' -- Fetching information --
For i = n + 1 To xeElements.Max
yData = New XMLNT
With yData
.sMatch = xeElements[i].GetChildrenByTagName("ns1:Name")[0].TextContent
.sMatchTime = xeElements[i].GetChildrenByTagName("ns1:Time")[0].TextContent
sSplit = subPickTime(.sMatchTime)
.sMatchDate = sSplit[0]
.sMatchTime = sSplit[1]
.sStatus = xeElements[i].GetChildrenByTagName("ns1:Status")[0].TextContent
.sLeague = xeElements[i].GetChildrenByTagName("ns1:ArrangementName")[0].TextContent
If (xeElements[i].GetChildrenByTagName("ns1:Withdrawn")[0].TextContent) == "false" Then
.bWithDrawn = False
Else If (xeElements[i].GetChildrenByTagName("ns1:Withdrawn")[0].TextContent) == "true" Then
.bWithDrawn = True
Endif
End With
rData.Add(yData)
Next
But I need to know how I can get the status code "100" from the statement "<ns1:Status Id="100">End</ns1:Status>".
The statement "xeElements[i].GetChildrenByTagName("ns1:Status")[0].TextContent" gives me the variable value "End".
Anyone ?
|