This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Html to database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Html to database" Watch "Html to database" New topic
Author

Html to database

S Raman
Greenhorn

Joined: Mar 29, 2006
Posts: 16
Hi,

I have a html file containing Financial Data
I want to convert the html and insert it into Database(Mysql)
I have around 2000 companies file.
For each file the datafield is obvious from file the additional two fields will correspond to company name and the quarter

Please suggest the methodology to follow


the following file I have shown only few rows ie types of expenses income etc



<HTML>
<HEAD>
<TITLE>Raw Materials</TITLE>
<link rel="stylesheet" href="style.css">
</HEAD>
<body bgcolor="#FFFFFF" topmargin="0" leftmargin="0">
<table border=0 cellspacing="0" cellpadding="0" width="610">
<tr valign="top">
<td width="2%"> </td>
<td width="96%">
<table border=0 cellspacing="1" cellpadding="0" width="100%" >
<tr valign="top">

<td align=center><font face=arial size=5 color="#014bae">Quarterly Results</font></td>

</tr>
<tr><td> </td></tr>
<tr>
<td align="center"width="40%" bgcolor="#F3CC00" colspan = 2><strong><font face="Arial" size="2">3i Infotech Ltd.</font></strong></td>
</tr>
<tr><td> </td></tr>

<tr><td align=right><font size=2>(Rs in Cr.)</font></td></tr>

</table>
<table width='100%' border='0' cellspacing='1' cellpadding='1' bgcolor = #1863ad>
<tr bgcolor = #73b5ce>
<td class='fnt5' ><b> </b></td>
<td class='fnt5' valign='center' align='center' ><b>Dec '06 </b></td>
<td class='fnt5' valign='center' align='center' ><b>Sep '06 </b></td>
<td class='fnt5' valign='center' align='center' ><b>Jun '06 </b></td>
<td class='fnt5' valign='center' align='center' ><b>Mar '06 </b></td>
<td class='fnt5' valign='center' align='center' ><b>Dec '05 </b></td>
</tr>
<tr>
<td class='fnt6' bgcolor=#FFFFFF > </td>
<td class='fnt6'bgcolor=#FFFFFF > </td>
<td class='fnt6'bgcolor=#FFFFFF > </td>
<td class='fnt6'bgcolor=#FFFFFF > </td>
<td class='fnt6'bgcolor=#FFFFFF > </td>
<td class='fnt6'bgcolor=#FFFFFF > </td>
</tr><td class='fnt6' bgcolor=#FFFFFF>Sales </td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 78.55</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 80.12</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 78.23</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 69.37</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 69.61</td>
</tr><td class='fnt6' bgcolor=#FFFFFF>Other Income </td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 6.93</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 4.05</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 4.08</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 1.44</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 2.09</td>
</tr>
<td class='fnt6' bgcolor=#FFFFFF>Stock Adjustment </td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
</tr>
<td class='fnt6' bgcolor=#FFFFFF>Raw Material </td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td></tr>
<td class='fnt6' bgcolor=#FFFFFF>Power And Fuel </td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
</tr>
<td class='fnt6' bgcolor=#FFFFFF>Employee Expenses </td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 22.50</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
</tr><td class='fnt6' bgcolor=#FFFFFF>Excise </td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
<td class='fnt6'bgcolor=#FFFFFF align='right'> 0.00</td>
</tr>
</table>
</td>
<td width="2%"> </td>
</tr>
</table>
</body>
</html>
<HTML>
<HEAD>
<TITLE>Ashika</TITLE>
</HEAD>
<link rel="stylesheet" href="style.css">
<body>
<table width="778" border="0" cellspacing="0" cellpadding="0">

</table>
</body>
</HTML>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

What does this have to do with XML?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
S Raman
Greenhorn

Joined: Mar 29, 2006
Posts: 16
Hi,

I thought we can use xml and xslt technoligy to convert html to xml to database.
besides I would like to have data in xml format for future reference.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

HTML is not a well formed markup language, so you can't apply XSLT to it. Also, XSLT is not a technology you can use to access a database. You need JDBC for that.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
You can use a library like TagSoup to convert HTML to something that an XML parser can work with.


Ping & DNS - my free Android networking tools app
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
The JTidy toolkit will create a sort of DOM from ill-formed HTML. You might be able to use that.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Html to database