473,405 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 1826
yaffa <ya*********@gmail.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**********@yahoo.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*********@gmail.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>something</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
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...
2
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...
0
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...
1
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
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...
0
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) ...
1
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 !!!! ...
2
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.