|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
i need to parse an html page for tabular data which i can then import
into mysql so i thought converting the html to xml might be a feasible thing to do, however, other than using tidy from the command line i can't find a way to do this from php. does anyone know of any class (or other) that would allow me to do this? or maybe i just need a different approach. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Slith wrote:
> i need to parse an html page for tabular data which i can then import > into mysql so i thought converting the html to xml might be a feasible > thing to do, however, other than using tidy from the command line i > can't find a way to do this from php. > > does anyone know of any class (or other) that would allow me to do > this? or maybe i just need a different approach. Is this a one-off or will you be doing this often? For a one-off I would just use sed/grep/awk/cut/tr etc. - HTML pages are rarely syntactically correct, so trying to parse them or even turn them into XML is tiresome at best. /Per Jessen, Zürich |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
> Slith wrote: > > > i need to parse an html page for tabular data which i can then import > > into mysql so i thought converting the html to xml might be a feasible > > thing to do, however, other than using tidy from the command line i > > can't find a way to do this from php. > > > > does anyone know of any class (or other) that would allow me to do > > this? or maybe i just need a different approach. > > Is this a one-off or will you be doing this often? > > For a one-off I would just use sed/grep/awk/cut/tr etc. - HTML pages are > rarely syntactically correct, so trying to parse them or even turn them > into XML is tiresome at best. For one-off, I'd simply copy/paste the data from the browser into Excel/OO Calc and save as CSV. Edward |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On 9/12/07, Slith <slithone@gmail.com> wrote:
> i need to parse an html page for tabular data which i can then import > into mysql so i thought converting the html to xml might be a feasible > thing to do, however, other than using tidy from the command line i > can't find a way to do this from php. > > does anyone know of any class (or other) that would allow me to do this? > or maybe i just need a different approach. use tidy. i do it all the time. note that it does its best, but it will get to xhtml at least; which is an xml compliant document. there's a pecl module for it, or you can just install the command line and run system() type calls too. http://tidy.sf.net (that would be if this is a regular thing, if it's a one time thing then yeah... do what Edward suggested and just manually do it once. sometimes you can't script things or it's too much effort... i've done way too many migrations and you usually always have some manual work ) |
|
![]() |
| Outils de la discussion | |
|
|