Re: DOM - parse HTML document
| From: | Leonidas Safran | Date: | Tue, 12 Sep 2006 20:42:02 +0000 |
| Subject: | Re: DOM - parse HTML document | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-241666@lists.php.net to get a copy of this message | ||
Hello Satyam,
> That is correct but it is not complete. Everything that relies
> on a unique id would fail, CSS amongst others(which is what this
> article covers), but not the only one.
> Basically there are two functions to get elements by id or name:
> getElementById and getElementsByName. Notice the first one returns
> a single element since there cannot be more than one, the second one
> returns a collection of elements, since duplicates are allowed. Thus,
> if you put an id in an element, it is because you want to reach it,
> but if the id is duplicated then you cannot reach it any longer.
Well, now that we know I can't change the fact that the website programmer used a multiple id
(website is not maintained by me), how can I manage to grab the content of "my"
<td>-fields?
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>
...
Using DOM functions for sure :-)
http://www.php.net/manual/en/ref.dom.php
Thank you for any help!
LS
--
NEU: GMX DSL Sofort-Start-Set – blitzschnell ins Internet!
Echte DSL-Flatrate ab 0,- Euro* http://www.gmx.net/de/go/dsl