Nov 25th, 2008, 05:19 PM
HTML document tool
No api calls today, but pure vb6. This tool "parses" html tags, then display them in a frame, you can edit their values one by one in a textbox. It also got some funky feature, you may find useful if you have to work with html documents.
Undercommented, not-so-well organized, but works just like it should. And its pure vb ^^
Ive done it in a couple of hours, but it was just 'nuff But, i'm still thinking on some better ways to do parsing html.
Anyway, have fun!
If you want to use this method in your code, to process html documents, you can simply replace the text1.selstart property, to a private or public variable, that is just used to store the string pointer.
Last edited by Jim Davis; Nov 30th, 2008 at 03:40 PM.
Reason: update 1
Nov 26th, 2008, 10:37 AM
Re: HTML document tool
just what i was looking for..great work..Jim Davis..let me check this one out..
Nov 26th, 2008, 12:51 PM
Re: HTML document tool
You can use the algorithm of the Forward button, that will walk thru on each tags. But, it will skip <script> and <style> tags! That means, a <script src=".."> will not be replaced. Its better to replace the code that does the skip, also comment out the <style> things.
For example, this will look for all <!-- --> tags and skip their content. These are the standards that used inside the <script and <style tags, to comment out the content, but the content will be interpreted by the browser, just wont show them.
'in Private Sub cmdForward_Click() ...
If InStr(1, LCase(Mid$(sHTMLDocument, Text1.SelStart, lSelLength)), "<!--", vbTextCompare) > 0 Then
lNewIndex = InStr(Text1.SelStart + lSelLength - 4, LCase(sHTMLDocument), "-->", vbTextCompare) + 3:
If lNewIndex < (Text1.SelStart + lSelLength - 4) Then lNewIndex = 0
' If InStr(1, LCase(Mid$(sHTMLDocument, Text1.SelStart, lSelLength)), "<style ", vbTextCompare) > 0 Or _
' InStr(1, LCase(Mid$(sHTMLDocument, Text1.SelStart, lSelLength)), "<style>", vbTextCompare) > 0 Then
' lNewIndex = InStr(Text1.SelStart + lSelLength - 9, LCase(sHTMLDocument), "</style>", vbTextCompare) + 9: GoTo ReCheck
' End If
After this modification, you can use the algo to walk thru the tags, that there you can execute the replacement for each src (cmdAuto2) and href (cmdAuto3) properties.
You can also try to combine the algos of cmdAuto2 and cmdAuto3.
Last edited by Jim Davis; Nov 26th, 2008 at 01:12 PM.
Click Here to Expand Forum to Full Width
Survey posted by VBForums.