M626
Programmer
- Mar 13, 2002
- 299
Ok,
Here is what I was try to accomplish with getting the number of time "<" appears in a string. I am reading in XML data comming in on port 9600 using Winsock and trying to grab and display the data between <KEYWORD> and </KEYWORD>. The data appears to come in as one contionious line with the carage returns showing up at the end of the line.
'I tried.
For i = 1 To Len(Data)
If Mid$(Data, i, 1) = "<" Then count = count + 1
If count = 10 Then
keyWordHolder = Mid(Data, 2, 17)
List1.AddItem keyWordHolder
End If
Next
also tried
If InStr(1, (Mid(Data, 2, 7)), "KEYWORD", vbBinaryCompare) Then
keyWordHolder = Mid(Data, 10, 14)
List1.AddItem keyWordHolder
End If
but becasue it's one continious line, it doesn't work.
I though if I did
For i = 1 To Len(Data)
If Mid$(Data, i, 1) = "<" Then count = count + 1
If count = 8 Then
keyWordHolder = Mid(Data, 2, 17)
List1.AddItem keyWordHolder
Next
but that doesn't work but maybe if I used
Mid(data, x, y)
x = lenght to 8th "<" found
Y = lenght to 9th "<" found
I am getting frustrated with this, any help would be greatly appreciated.
thanks,
SAMPLE DATA
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE MAJORLEAGUEDSTAT SYSTEM "Xmldtds/Major League
Baseball/MAJORLEAGUEDSTAT.dtd">
<MAJORLEAGUEDSTAT selectorcode="DSMLB" league="BBA" category="STAT">
<STORYNUMBER>9000-NON-EVENT-MESSAGE-X</STORYNUMBER>
<SELECTORCODE>DSMLB</SELECTORCODE>
<KEYWORD>BC-BBA-STAT-AL1DAYCENT</KEYWORD>
<VERSION> </VERSION>
<DATE>10-04</DATE>
<WORDCOUNT>0000</WORDCOUNT>
<DATETIME>st 10-04-04 19:50 et</DATETIME>
<HRECORD>
<H_RECTYPE>H</H_RECTYPE>
<H_RECNUMBER>0000001</H_RECNUMBER>
<H_FEEDTYPE>MLBD</H_FEEDTYPE>
<H_LEAGUE>AL</H_LEAGUE>
<H_DIVISION>CENT</H_DIVISION>
<H_SEASON>R</H_SEASON>
<H_GAMEDATE>20041003</H_GAMEDATE>
<H_CREATEDATE>20041004</H_CREATEDATE>
<H_CREATETIME>195059</H_CREATETIME>
</HRECORD>
</MAJORLEAGUEDSTAT>
Here is what I was try to accomplish with getting the number of time "<" appears in a string. I am reading in XML data comming in on port 9600 using Winsock and trying to grab and display the data between <KEYWORD> and </KEYWORD>. The data appears to come in as one contionious line with the carage returns showing up at the end of the line.
'I tried.
For i = 1 To Len(Data)
If Mid$(Data, i, 1) = "<" Then count = count + 1
If count = 10 Then
keyWordHolder = Mid(Data, 2, 17)
List1.AddItem keyWordHolder
End If
Next
also tried
If InStr(1, (Mid(Data, 2, 7)), "KEYWORD", vbBinaryCompare) Then
keyWordHolder = Mid(Data, 10, 14)
List1.AddItem keyWordHolder
End If
but becasue it's one continious line, it doesn't work.
I though if I did
For i = 1 To Len(Data)
If Mid$(Data, i, 1) = "<" Then count = count + 1
If count = 8 Then
keyWordHolder = Mid(Data, 2, 17)
List1.AddItem keyWordHolder
Next
but that doesn't work but maybe if I used
Mid(data, x, y)
x = lenght to 8th "<" found
Y = lenght to 9th "<" found
I am getting frustrated with this, any help would be greatly appreciated.
thanks,
SAMPLE DATA
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE MAJORLEAGUEDSTAT SYSTEM "Xmldtds/Major League
Baseball/MAJORLEAGUEDSTAT.dtd">
<MAJORLEAGUEDSTAT selectorcode="DSMLB" league="BBA" category="STAT">
<STORYNUMBER>9000-NON-EVENT-MESSAGE-X</STORYNUMBER>
<SELECTORCODE>DSMLB</SELECTORCODE>
<KEYWORD>BC-BBA-STAT-AL1DAYCENT</KEYWORD>
<VERSION> </VERSION>
<DATE>10-04</DATE>
<WORDCOUNT>0000</WORDCOUNT>
<DATETIME>st 10-04-04 19:50 et</DATETIME>
<HRECORD>
<H_RECTYPE>H</H_RECTYPE>
<H_RECNUMBER>0000001</H_RECNUMBER>
<H_FEEDTYPE>MLBD</H_FEEDTYPE>
<H_LEAGUE>AL</H_LEAGUE>
<H_DIVISION>CENT</H_DIVISION>
<H_SEASON>R</H_SEASON>
<H_GAMEDATE>20041003</H_GAMEDATE>
<H_CREATEDATE>20041004</H_CREATEDATE>
<H_CREATETIME>195059</H_CREATETIME>
</HRECORD>
</MAJORLEAGUEDSTAT>