473,789 Members | 2,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sample code for parsing html file to get contents of td fields

does anyone have sample code for parsting an html file to get contents
of a td field to write to a mysql db? even if you have everything but
the mysql db part ill take it.

thanks

yaffa

Aug 4 '05 #1
3 1848
yaffa <ya*********@gm ail.com> wrote:
does anyone have sample code for parsting an html file to get contents
of a td field to write to a mysql db? even if you have everything but
the mysql db part ill take it.


I usually use Expat XML parser to extract the field.
http://home.eol.ca/~parkw/index.html#expat

Expat is everywhere. Python has it and even Gawk has it.

--
William Park <op**********@y ahoo.ca>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/
Aug 4 '05 #2
On 4 Aug 2005 11:54:38 -0700, yaffa <ya*********@gm ail.com> wrote:
does anyone have sample code for parsting an html file to get contents
of a td field to write to a mysql db? even if you have everything but
the mysql db part ill take it.


Do you want something like this?

In [1]: x = "something <td><b>somethin g</b> else</td> and\nanother thing <td>in
a td</td> and again else"

In [2]: import re

In [3]: r = re.compile('<td >(.*?)</td>', re.S)

In [4]: r.findall(x)
Out[4]: ['<b>something</b> else', 'in a td']

If not, you'll have to explain more clearly what you want.

Peace
Bill Mill
bill.mill at gmail.com
Aug 4 '05 #3
yaffa wrote:
does anyone have sample code for parsting an html file to get contents
of a td field to write to a mysql db? even if you have everything but
the mysql db part ill take it.


http://www.crummy.com/software/Beaut.../examples.html
Aug 4 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8265
by: darcykahle | last post by:
Is there any way of converting an existing access form into html format? The form in question has built-in visual-basic code, which gets commented out when you use the "save as" method, instead of incorporated into the functionality of the html. We are considering putting these html versions onto an IIS server for internal use, but we do not want to re-write all of the code for use in the html version.
2
1963
by: Xavier | last post by:
Hi, I've just download Xerces2 Java and I'd like to parse an HTML file using the HTMLDOMImplementation found in the org.apache.html.dom package. First I try : DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
0
2273
by: egp | last post by:
Hi guys, I have a database using Ms Access 2003 connected to VB6 using ADODB Connection and I want to know how to: - display Ms Access report in VB using VB code then print it out - backup and restore Ms Access table using VB code - open HTML file using VB code Is there anyone can help me please? It's urgent. Thanks before
1
3287
by: Ria | last post by:
How to copy the contents of a file into another file in C++. how to use these parameters in c++ code (i) ios::in (ii) ios::out (iii) ios::noreplace
1
1228
by: leguvan | last post by:
Hi, I am trying to use preg_match to help parse an html file uploaded to the server. Right now I am just trying to get information that is between <b> and </b>, everything I have tried has returned errors by preg_match. I have tried using multiple patterns posted that I have seen and none have worked. '<b>match1</b>' , character: '<b>match2</b>' trying to get an expression to get match1 and match 2 out of that string... Thanks for...
0
1239
by: veer | last post by:
Hi can any one help me by providing the method how i read the text from html file. i did it by this method Open newstr For Input As #1 While Not EOF(1) Line Input #1, strtemp txtfile = txtfile & strtemp Wend Close #1
1
2630
by: =?Utf-8?B?R2hpc3Rvcw==?= | last post by:
Hi, I have an .htm file saved on my C:\ drive. I want to open it in my windows app using HTMLDocument. I'm not able to find any object who can help me to do this. Any clue someone please !!!! Tks
2
3349
by: Bentot | last post by:
For the code below I only see "Hello PhP" and not the Hello World! <h1>Hello PhP</h1> <?php echo "Hello World!"; ?>
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10195
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4090
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.