|
-
Jun 10th, 2006, 02:44 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] parsing an html file
iam working on a small applic that extracts the last person who has scrapped in my scrapbook
the saved html page should explain everything abt scraps and scrapbook etc
i also attached a sample screenshot with the required link circled in the screenshot...
i tried the following but din work:
VB Code:
Dim PosEnd As Long
Dim PosStart As Long
PosStart = InStr(WebBrowser1.Document.body.innerHTML, "<a class="P" href="/Profile.aspx?uid=")
....
this will not work as the match string contains quotes
and one more thing to note that here i have scrapped myself hence the uid=....(19 digit number) is the same everywhere which does not happen in a normal scenario.
i have an inetcontrol that is loading the page .i am using
VB Code:
WebBrowser1.Document.getElementsByTagName("b").Item(i + 2).innerText....
to parse other elemnts but this one seems to be too complex
any ideas anyone??
Last edited by litlewiki; Apr 13th, 2007 at 02:02 PM.
-
Jun 10th, 2006, 02:53 PM
#2
Re: parsing an html file
to answer your first question:
where you want to place " in a string, use "", e.g.:
VB Code:
Debug.Print "<a class=""P"" href=""/Profile.aspx?uid="
would give you:
Code:
<a class="P" href="/Profile.aspx?uid=
-
Jun 10th, 2006, 02:57 PM
#3
PowerPoster
Re: parsing an html file
First question...the line where you have " in the code...one which starts with "PosStart"...where you see a ", you need to put " & chr(34) & " (note the quote at the start and end...this closes the string so you can do variable functions, then reopens it for new text
so change:
"<a class="P" href="/Profile.aspx?uid="
into
"<a class=" & chr(34) & "P" & chr(34) & " href=" & chr(34) & "/Profile.aspx?uid="
Edit: I assume bush's way will work too...if not, mine definitely does :-)
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
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
|