Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 6th, 2003, 07:15 PM
Authorized User
 
Join Date: Jun 2003
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??
 
Old June 6th, 2003, 07:29 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
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
 
Old June 8th, 2003, 07:09 PM
Authorized User
 
Join Date: Jun 2003
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.
 
Old June 8th, 2003, 09:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
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
 
Old June 9th, 2003, 01:21 AM
Registered User
 
Join Date: Jun 2003
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
 
Old June 9th, 2003, 08:59 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
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
 
Old June 9th, 2003, 08:09 PM
Authorized User
 
Join Date: Jun 2003
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?
 
Old June 10th, 2003, 07:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
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
 
Old June 10th, 2003, 09:37 PM
Authorized User
 
Join Date: Jun 2003
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?
 
Old June 11th, 2003, 10:18 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
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





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.