Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 17th, 2005, 2:05 PM   #1
printf
Newbie
 
Join Date: Oct 2005
Posts: 4
Rep Power: 0 printf is on a distinguished road
SGML parser

Hi

I am working on a SGML parser converted from MIT(s) SGML parser, the same W3C uses. In the notes from the author it says the following!

function htmlline2pixelline()

/* The class function returns the current line of the document it is parsing.
* It's your responsibility to record the string length and then pack() it's value
* using the lower case 'v' flag. Add that value then the hex value '0x0000'
* followed by the line data from htmlline2pixelline() to the file holding the
* the output, calling $this->sgml_file ( $data ); or if your holding the output
* in memory write the data to $this->sgml_stream ( $data );
*/

This what I am doing

// converts the current HTML line to dec (single pixel color)

$data = $this->htmlline2pixelline ( $line[$x] );

// get the line length

$len = strlen ( $data );

// add it to the image create data...

$this->sgml_stream ( pack ( 'v', $len ) . "0x0000" . pack ( 'v', $data ) );

// So my question is...

Does it look like I am doing exactly what the author has said to do. I am wondering because the web page to image conversion does not look very good. example...

http://24.218.196.82/snap.gif

Notice it is not clear and has the same pattern running through the complete image. The SGML parser is to create a HTML Document tree (outline) of the document URL passed to it. I am trying to extended it so I can create images of webpages using different browsers and their RENDERING, DOM and CSS rules, so one can see what their page looks like in different browsers without the need to install one, doing it with pure PHP and the standard GD lib only!


Thanks

printf
printf is offline   Reply With Quote
Old Oct 17th, 2005, 4:52 PM   #2
printf
Newbie
 
Join Date: Oct 2005
Posts: 4
Rep Power: 0 printf is on a distinguished road
Ok I figured it out. I was packing the $data, when I all I should have been doing was pack() the strings length because the data was already put in format that the webpage image function needed...

I'm A Happy Camper

printf
printf is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:41 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC