Re: DOM - parse HTML document

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Satyam,

Thanks for your answering...

>> I don't really get it to work with that functions from
>> http://www.php.net/manual/en/ref.dom.php

>> I try to get the content of <td> fields on an external html page, where
>> I just know some ids of the rows.

>> Example:
>> ...
>> <tr id = 'tr01'>
>> <td>1</td><td>2</td><td>3</td><td>4</td>
>> </tr>
>> <tr id = 'tr02'>
>> <td>1</td><td>2</td><td>3</td><td>4</td>
>> </tr>
>> <tr id = 'tr01'>
>> <td>1</td><td>2</td><td>3</td><td>4</td>
>> </tr>
>><tr id = 'tr02'>
>> <td>1</td><td>2</td><td>3</td><td>4</td>
>> </tr>
>> ...

>> PS: Please note, that id is written more than once. So 
>> DomDocument->getElementById('tr01') returns only one element and not two
>> or more...

>> I can't find out how to grab the data in the td fields... I don't find
>> examples to look at... :-(

>> I'd be really glad if somebody could give me some advice or tutorial 
>> websites about that...

> To start with, an ID should never be repeated.  A name can be repeated, 
> an ID shouldn't.  That is why there is a function to get an array of 
> elements with a certain name but there is none to get a list of elements 
> with the same ID simply because there shouldn't be any.   Something 
> helpful in traversing  the DOM is any tool that gives you a good view of 
> the tree structure.  One such comes already in the Firefox browser.

Unfortunately, I have no way to modify the source html page, it's on the web.

By the way, because I found it strange to have more than one field with the same id, I looked on the famous selfhtml tutorial website http://de.selfhtml.org which says that unique id is only mandatory for css, but not for javascript actually. I was surprised...
http://de.selfhtml.org/css/formate/zentrale.htm#individualformate
http://en.selfhtml.org/css/formate/zentrale.htm#individualformate
(english translation is a little different)


LS
-- 


"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux