|
-
Apr 8th, 2007, 09:24 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] Parsing XML
Hello, I'm trying to parse a XML file, but I have never done that before. I've looked at a whole bunch of examples, but I'm already stuck at the beginning.
I need to have the following parts:
On the 'file poster' line the filename "mts-mrb.rar" in the subject between """
From each segment the segment bytes, segment number and the long string after the number (the number of segments are not always 10)
Then the same with the next part, filename "mts-mrb.r00" on the next 'file poster' line, etc.
Code:
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE nzb PUBLIC "-//newzBin//DTD NZB 1.0//EN" "http://www.newzbin.com/DTD/nzb/nzb-1.0.dtd">
<!-- NZB Generated by Binsearch.info -->
<nzb xmlns="http://www.newzbin.com/DTD/2003/nzb">
<file poster="[email protected] (YencL8 (Chil))" date="1175837221" subject="(Test Rar File)"mts-mrb.rar" yEnc (1/10)">
<groups><group>alt.binaries.paxer</group></groups>
<segments>
<segment bytes="258743" number="1">[email protected]</segment>
<segment bytes="258871" number="2">[email protected]</segment>
<segment bytes="258724" number="3">[email protected]</segment>
<segment bytes="258831" number="4">[email protected]</segment>
<segment bytes="258642" number="5">[email protected]</segment>
<segment bytes="258797" number="6">[email protected]</segment>
<segment bytes="258783" number="7">[email protected]</segment>
<segment bytes="258687" number="8">[email protected]</segment>
<segment bytes="258790" number="9">[email protected]</segment>
<segment bytes="25854" number="10">[email protected]</segment>
</segments>
</file>
<file poster="[email protected] (YencL8 (Chil))" date="1175849534" subject="(Test Rar File)"mts-mrb.r00" yEnc (1/10)">
<groups><group>alt.binaries.paxer</group></groups>
<segments>
<segment bytes="256615" number="1">[email protected]</segment>
<segment bytes="256502" number="2">[email protected]</segment>
<segment bytes="256237" number="3">[email protected]</segment>
<segment bytes="256238" number="4">[email protected]</segment>
<segment bytes="256139" number="5">[email protected]</segment>
<segment bytes="256558" number="6">[email protected]</segment>
<segment bytes="256618" number="7">[email protected]</segment>
<segment bytes="256658" number="8">[email protected]</segment>
<segment bytes="256713" number="9">[email protected]</segment>
<segment bytes="25813" number="10">[email protected]</segment>
</segments>
</file>
</nzb>
I'm getting an "Expected token 'EOF' found 'NAME'" error.
Can anyone please tell me how to start with this? Thank you.
VB Code:
Private Sub Command1_Click()
Dim oxmlNodeList As IXMLDOMNodeList
Dim XMLDoc As MSXML2.DOMDocument40
Set XMLDoc = New DOMDocument40
XMLDoc.async = False
XMLDoc.validateOnParse = False
XMLDoc.preserveWhiteSpace = False
XMLDoc.Load "C:\1175965453.xml"
If XMLDoc.parseError.errorCode = 0 Then
If XMLDoc.readyState = 4 Then
DoEvents
End If
Else
Err.Description = XMLDoc.parseError.reason & vbCrLf & _
"Line: " & XMLDoc.parseError.Line & vbCrLf & _
"XML: " & XMLDoc.parseError.srcText
Err.Raise 1006
End If
Set oxmlNodeList = XMLDoc.documentElement.selectNodes("/nzb xmlns")
Set XMLDoc = Nothing
Set oxmlNodeList = Nothing
End Sub
Last edited by Chris001; Sep 12th, 2010 at 12:40 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|