[PHP] html to xml?

2007-09-12 Thread Slith
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.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] html to xml?

2007-09-12 Thread Per Jessen
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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] html to xml?

2007-09-12 Thread Edward Kay

 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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] html to xml?

2007-09-12 Thread mike
On 9/12/07, Slith [EMAIL PROTECTED] 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
:))

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HTML (to XML?) to PDF

2002-03-20 Thread Chris Boget

 Hm.  If you can't store the data as XML from the beginning (doesn't it 
 make more sense to go from XML to HTML than vice versa?), 

Yes, it does.  However, the people creating these templates don't know
XML, only HTML.  As such, that is how they are going to be stored. :|

 If your initial document is in XHTML form, you should be able to use 
 XSLT, since XHTML is a form of XML.

Yes, that would be the ideal situation.  However, that won't be the case.
So I need to find out some way to be able to either:

* Print the HTML (less tags, keep formatting) to PDF
* Convert the HTML to XML to I can then pass that onto the PDFClass
we are using.

Chris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] HTML (to XML?) to PDF

2002-03-20 Thread Chris Boget

 I need to take what is presented to the user (ie, the data less the
 HTML tags but maintaining the formatting) and turn it into a PDF
 file.

I found the solution with HTMLDoc (http://www.easysw.com/htmldoc/)
It was very easy to set up and use.  I heartily recommend it for anyone
who has the same problem I had.
Thanks for all the suggestions!

Chris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] HTML (to XML?) to PDF

2002-03-19 Thread Chris Boget

Here is my situation:

I've got HTML Templates that I'm using to parse and presents
the end result to the user.

Here is my dilemma:

I need to take what is presented to the user (ie, the data less the
HTML tags but maintaining the formatting) and turn it into a PDF
file.

I know I can use PDFLib to turn data into a PDF.  However, it
doesn't understand HTML so I can't just send it the same thing
I'm sending to the browser via stdout.  Is there a routine, a class
or a set of functions out there that would take the result and give
me just the data the end user sees (ie, less the HTML tags)?  Or
even turn the HTML into XML?
One thing to remember, since this is using the results of a parsed
template, I would need to be able to do all of this on the fly.

I don't necessarily need the code that does this, just pointers on
where I can go look and find out how I can do this.  
Thanks for any help you can provide!

Chris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] HTML (to XML?) to PDF

2002-03-19 Thread Erik Price


On Tuesday, March 19, 2002, at 03:48  PM, Chris Boget wrote:

 I need to take what is presented to the user (ie, the data less the
 HTML tags but maintaining the formatting) and turn it into a PDF
 file.

 I know I can use PDFLib to turn data into a PDF.  However, it
 doesn't understand HTML so I can't just send it the same thing
 I'm sending to the browser via stdout.  Is there a routine, a class
 or a set of functions out there that would take the result and give
 me just the data the end user sees (ie, less the HTML tags)?  Or
 even turn the HTML into XML?
 One thing to remember, since this is using the results of a parsed
 template, I would need to be able to do all of this on the fly.

 I don't necessarily need the code that does this, just pointers on
 where I can go look and find out how I can do this.
 Thanks for any help you can provide!

Hm.  If you can't store the data as XML from the beginning (doesn't it 
make more sense to go from XML to HTML than vice versa?), you might 
still be able to get away with using XSLT to do what you want.  I think 
in order for it to work your initial document has to be some kind of 
XML, but XHTML should work in theory.  What I just said came out 
somewhat confusing --

If your initial document is in XHTML form, you should be able to use 
XSLT, since XHTML is a form of XML.

HTH,

Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] HTML in XML???

2001-07-19 Thread Christian Reiniger

On Wednesday 18 July 2001 16:10, Leon wrote:
 Hi,
 Is there some way to include HTML tags in a XML doc???
 I want to use a XML document to include HTML data for my
 webpage. I have made a solution of replacing a special word to
 the '' and ' of a HTML tag.
 But I think my solution is very stupid.

This should work:

myhtmlcode![CDATA[headtitlemy html 
code/title/head]]/myhtmlcode

-- 
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)

REALITY.SYS corrupted ... reboot Universe [Y,n]?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] HTML in XML???

2001-07-18 Thread Leon

Hi,
Is there some way to include HTML tags in a XML doc???
I want to use a XML document to include HTML data for my
webpage. I have made a solution of replacing a special word to
the '' and ' of a HTML tag.
But I think my solution is very stupid.

And is there a special php xml newsgroup??

thanks,
Leon



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] HTML in XML???

2001-07-18 Thread Jens Wabnitz

 Is there some way to include HTML tags in a XML doc???

Yes, if your HTML is wellformed - XHTML


 And is there a special php xml newsgroup??

http://www.onlamp.com/pub/a/php/php-xml-ml.html

Bye
Jens


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]