XMl/HTMLSax - Parsing Textarea fields
| From: | Peter | Date: | Sat, 17 Apr 2004 21:20:07 +0000 |
| Subject: | XMl/HTMLSax - Parsing Textarea fields | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-11935@lists.php.net to get a copy of this message | ||
Hello,
I just try to use the XML/HTMLSax.php class which looks like to work well.
I use this class to extract the form elemets of an html page.
I use it like the example in the README file,
But here I have to problems/questions:
1. TEXTAREA
In the print_r($attrs) shows me:
:::TEXTAREA:::
Array
(
[NAME] => sun_note
[ROWS] => 16
[COLS] => 80
[WRAP] => SOFT
)
But what about the value. What is between <textarea .*> </textarea>.
How can this be parsed - or returned?
2. SELECT
I have in some html souerces found like this:
<option selected> test 1
<option> test 2
No closing option or value or else. So the parser return me:
:::SELECT:::
Array
(
[name] => log_status
)
::OPTION:::
Array
(
[selected] => selected
)
:::OPTION:::
Array
(
)
He're I missing the value to returned which would be "test 1" and "test 2".
Any hints?
My programmcode is simple an copy and paste:
require_once 'RALparser.php';
require_once 'XML/XML_HTMLSax.php';
$handler =& new RALparser();
$parser =& new XML_HTMLSax();
$parser->set_object($handler);
$parser->set_option('XML_OPTION_CASE_FOLDING');
$parser->set_element_handler('openHandler', 'closeHandler');
$htmlCode = file_get_contents( 'case.cgi.html');
$parser->parse($htmlCode);
Would be very nice I someone can help me.
Cheers
-Peter