DOM Bug?

DOM Bug?

am 18.04.2008 18:37:16 von sathia

Hello

Reproduce code:
---------------
Html:
this textarea has inside it a reference to an external image
[...]

[...]


Php:

$documentx = new DOMDocument();
$documentx->loadHTML($data);
$textareas = $documentx->getElementsByTagName("textarea");
foreach($textareas AS $textarea){
   print($textarea->getAttribute("value"));
   print($textarea->textContent);
}

I know there's no "value" attribute in the textarea, but if the content of
said textarea is wrapped in < and > there's no way to read it.

ideas?
--
e ziocan

Re: DOM Bug?

am 18.04.2008 19:24:42 von AlmostBob



might work

--
Adaware http://www.lavasoft.de
spybot http://security.kolla.de
AVG free antivirus http://www.grisoft.com
Etrust/Vet/CA.online Antivirus scan
http://www3.ca.com/securityadvisor/virusinfo/scan.aspx
Panda online AntiVirus scan http://www.pandasoftware.com/ActiveScan/
Catalog of removal tools (1)
http://www.pandasoftware.com/download/utilities/
Catalog of removal tools (2)
http://www3.ca.com/securityadvisor/newsinfo/collateral.aspx? CID=40387
Blocking Unwanted Parasites with a Hosts file
http://mvps.org/winhelp2002/hosts.htm
links provided as a courtesy, read all instructions on the pages before use

Grateful thanks to the authors and webmasters
_

"motion musso: aka sathia" wrote in message
news:074Oj.292512$%k.403029@twister2.libero.it...
> Hello
>
> Reproduce code:
> ---------------
> Html:
> this textarea has inside it a reference to an external image
> [...]
>
> [...]
>
>
> Php:
>
> $documentx = new DOMDocument();
> $documentx->loadHTML($data);
> $textareas = $documentx->getElementsByTagName("textarea");
> foreach($textareas AS $textarea){
> print($textarea->getAttribute("value"));
> print($textarea->textContent);
> }
>
> I know there's no "value" attribute in the textarea, but if the content of
> said textarea is wrapped in < and > there's no way to read it.
>
> ideas?
> --
> e ziocan

Re: DOM Bug?

am 18.04.2008 19:44:48 von sathia

AlmostBob wrote:

>
>
> might work
>

this is really far from what I expected to read,
sorry but it's not a problem with style.

I surely explained myself in an awful way.

I was complaining that you can't read the content of a textarea via DOM if
it is surrounded with <>

regards

--
e ziocan

Re: DOM Bug?

am 18.04.2008 23:57:44 von Jerry Stuckle

motion musso: aka sathia wrote:
> Hello
>
> Reproduce code:
> ---------------
> Html:
> this textarea has inside it a reference to an external image
> [...]
>
> [...]
>
>
> Php:
>
> $documentx = new DOMDocument();
> $documentx->loadHTML($data);
> $textareas = $documentx->getElementsByTagName("textarea");
> foreach($textareas AS $textarea){
> print($textarea->getAttribute("value"));
> print($textarea->textContent);
> }
>
> I know there's no "value" attribute in the textarea, but if the content of
> said textarea is wrapped in < and > there's no way to read it.
>
> ideas?

I haven't tried this particular one, but is it maybe considered a child
node of the textarea?

I'm just not sure if this is valid xml or not - don't know if you can
have an img within a textarea.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: DOM Bug?

am 19.04.2008 00:49:14 von sathia

Jerry Stuckle wrote:

> I haven't tried this particular one, but is it maybe considered a child
> node of the textarea?

nope, it pure text, but...


>
> I'm just not sure if this is valid xml or not - don't know if you can
> have an img within a textarea.


you should not consider it as a node, but it should be valid as text (ie:
let's say I have a CMS in which i need to enter an embed tag from a
textarea, (an input field would do the trick) )

the problem is that for php it isn't text but it isn't a node as well.



--
e ziocan

Re: DOM Bug?

am 19.04.2008 03:49:02 von Jerry Stuckle

motion musso: aka sathia wrote:
> Jerry Stuckle wrote:
>
>> I haven't tried this particular one, but is it maybe considered a child
>> node of the textarea?
>
> nope, it pure text, but...
>
>
>> I'm just not sure if this is valid xml or not - don't know if you can
>> have an img within a textarea.
>
>
> you should not consider it as a node, but it should be valid as text (ie:
> let's say I have a CMS in which i need to enter an embed tag from a
> textarea, (an input field would do the trick) )
>
> the problem is that for php it isn't text but it isn't a node as well.
>
>
>

No, <img src="foobar" /< would be text.
should be a node.

< and > are not legitimate XML characters, other than as tag delimiters.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: DOM Bug?

am 19.04.2008 04:43:29 von Jeff North

On Fri, 18 Apr 2008 16:37:16 GMT, in alt.php "motion musso: aka
sathia"
<074Oj.292512$%k.403029@twister2.libero.it> wrote:

>| Hello
>|
>| Reproduce code:
>| ---------------
>| Html:
>| this textarea has inside it a reference to an external image
>| [...]
>|
>| [...]
>|
>|
>| Php:
>|
>| $documentx = new DOMDocument();
>| $documentx->loadHTML($data);
>| $textareas = $documentx->getElementsByTagName("textarea");
>| foreach($textareas AS $textarea){
>|    print($textarea->getAttribute("value"));
>|    print($textarea->textContent);
>| }
>|
>| I know there's no "value" attribute in the textarea, but if the content of
>| said textarea is wrapped in < and > there's no way to read it.
>|
>| ideas?

I'd look at the library that you are using and checking what
'textContent' is looking at and it's return value.

AFAIK, textarea contents can be accessed by
value or childNodes[0].nodeValue
-- ------------------------------------------------------------ -
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
-- ------------------------------------------------------------ -