Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 6th, 2003, 07:15 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to beyondforsaken Send a message via MSN to beyondforsaken
Default Eliminating HTML TAGs

hi i have a code here but i have a error eliminating it

Dim a As String
        a = txtfile.Text
        If a <> <td bgcolor= "#C9EDFF" height="12" class="resulttext2" width="256">Featured Businesses </td><td height="12" width="120" class="resulttext2" >Address </td><td height="12" width="79" class="resulttext2" >Phone</td> Then
  txtfile.text=""

but i have blue wavy lines how to i eliminating those lines that are not the lines above??
Reply With Quote
  #2 (permalink)  
Old June 6th, 2003, 07:29 PM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

The code you have pasted isn't close to being something that would work. Perhaps you pasted something wrong?

If that's what it says in your file, there's no way you could expect it to work.

Perhaps if you tell us what your trying to do....


Hal Levy
Daddyshome, LLC
Reply With Quote
  #3 (permalink)  
Old June 8th, 2003, 07:09 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to beyondforsaken Send a message via MSN to beyondforsaken
Default

i am just trying to filter a html page and the above is what i want it's actually a table of information.
Reply With Quote
  #4 (permalink)  
Old June 8th, 2003, 09:59 PM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I think I understand... But.. The way your going about it isn't going to work.

There are two problems

1. Your string isn't in quotes...
2. The way you wrote this, your saying strip out everything that isn't HTML.

If your trying to strip HTML, and want to use this IF statement and you know that "<td bgcolor" will always start it then write this:

If left(a, 11) = "<td bgcolor" then a = ""

This takes the string you get back from the file and set your variable to an empty string.

That said- I would use a routine like This one to do what your trying.


Hal Levy
Daddyshome, LLC
Reply With Quote
  #5 (permalink)  
Old June 9th, 2003, 01:21 AM
Registered User
 
Join Date: Jun 2003
Location: Brighton, Sussex, United Kingdom.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mark.roworth
Default

HTML is just a type of XML. Load it into an XMLdomobject. You should be able to locate the information within that. For more information on manipulating XML, see http://www.w3schools.com/. Won't be able to answer anything more for a week, 'cos I'm going to Turkey for a week in about 5 minutes. Hope this helps.

Mark

Mark Roworth
Reply With Quote
  #6 (permalink)  
Old June 9th, 2003, 08:59 AM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Mark,

I Disagree. HTML- quite often- does not comply with XML. For example, many people will use a <BR> without an ending tag- would would confuse most XML processors. Not only that, it's overkill to do all that work when a simple REGEX will do it for him.

Hal Levy
Daddyshome, LLC
Reply With Quote
  #7 (permalink)  
Old June 9th, 2003, 08:09 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to beyondforsaken Send a message via MSN to beyondforsaken
Default

Quote:
quote:Originally posted by Hal Levy
 I think I understand... But.. The way your going about it isn't going to work.

There are two problems

1. Your string isn't in quotes...
2. The way you wrote this, your saying strip out everything that isn't HTML.

If your trying to strip HTML, and want to use this IF statement and you know that "<td bgcolor" will always start it then write this:

If left(a, 11) = "<td bgcolor" then a = ""

This takes the string you get back from the file and set your variable to an empty string.

That said- I would use a routine like This one to do what your trying.


Hal Levy
Daddyshome, LLC
 Q.1) thanks but what does the "this one" mean i got the code but ...sorry to ask but how do i use it?? can i simply just paste it under a button_click

Q 2.)My main objective actually is to achive real-time updating of information from a website wwww.yellowpages.com.sg.i'm trying to do something like a search engine where by people use this program i do to look for information.But u never know when the website's information might chage so we ned real time updating .After surfing and searching on the internet i found nothing close to that.Can u give me a book or website to help achieve this?
Reply With Quote
  #8 (permalink)  
Old June 10th, 2003, 07:31 AM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

If you click on THIS ONE it's a link to a example routine to to the removal of HTML tags from a text stream.


Here is the link in plain text: http://www.planet-source-code.com/vb...txtCodeId=6269

How to use the function is pretty straight forward. Instructions are right there on the page.

Hal Levy
Daddyshome, LLC
Reply With Quote
  #9 (permalink)  
Old June 10th, 2003, 09:37 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to beyondforsaken Send a message via MSN to beyondforsaken
Default

hi Hal Levy,
              do u know the answer to my second question?
Reply With Quote
  #10 (permalink)  
Old June 11th, 2003, 10:18 AM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I can't write the code for you- If you use the HTTP functions that come with .NET along with the routine to parse out HTML you will be able to scrape the HTML screen for the data (as long as they don't change their format).

Personally, I would expect what your doing is against the TOS over at the site your hitting, so I can't condone or assist in that process.



Hal Levy
Daddyshome, LLC
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML tags issue.. atulshin XSLT 2 October 21st, 2008 03:57 AM
add HTML tags via XSLT chopswil2 XSLT 3 November 5th, 2007 09:30 AM
Render HTML tags jacksprophet XSLT 1 December 28th, 2006 07:03 PM
Generating html tags dynamically sachin lad Servlets 1 April 26th, 2005 05:35 PM
remove html tags lucian Dreamweaver (all versions) 1 November 14th, 2004 03:25 PM



All times are GMT -4. The time now is 04:33 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.