Peter Clarke wrote:
>"Aaron" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>>Well that works. But its a little bizzare. I have to do that to get the
>>content of a node even when that node has no children...
>>
>>e.g.
>><root>
>> <stuff>
>> <morestuff>SOME TEXT GOES HERE</morestuff>
>> </stuff>
>></root>
>>
>>So even if the current node is "morestuff" I still have to do the
>>currentnode->children etc. blah.
>>
>>which is a bit dodgey
>>
>
>Ah but the content of the node IS a child of the node. Everything inside a
>node is it's child
>eg:
><p>html line 1<br/>html line 2</p>
>The children of <p> are:
>'html line 1' AND '<br/>' AND 'html line 2'
>
>Peter
>
Yeah that makes sense. There aint really any way around it. But there
should be a way to say that a particluar node is the last in the chain.
i dunno like if the entire contents is CDATA. so.
<p><![CDATA[html line 1<br/>html line 2]]></p>
This would not have a child as content, only content. Thats how I see it anyway.
on the other hand :
<p>html line 1<br/>html line 2</p>
as you said above would have child as content, that makes sense.
Supposedly all this is quite likely to change in the future anyway..... So i guess it
doesnt matter.
Well either way, as long as I can find documentation on how it works I'm
happy. :)
>
>>Peter Clarke wrote:
>>
>>>function getNodeContent ($node) {
>>> $content = '';
>>> $nodechild = $node->children();
>>> if ( is_array( $nodechild ) ) {
>>> reset ($nodechild);
>>> while (list (, $val) = each ($nodechild)) {
>>> if ( $val->type == XML_TEXT_NODE ) {
>>> $content .= $val->content;
>>> }
>>> }
>>> return $content;
>>> }
>>>}
>>>
>>>Peter
>>>
>>>
>>>"Aaron" <[EMAIL PROTECTED]> wrote in message
>>>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>>>
>>>>How the hell do I get the content of a node....
>>>>
>>>>before all I had to do was go $node->content
>>>>
>>>>now it doesnt seem to work.
>>>>
>>>>I know they changed $node->name to $node->tagname.
>>>>
>>>>I tried, content, tagcontent, value, mmm some other things. I give up,
>>>>couldnt find any info anywhere either...
>>>>
>>>>theres a set_content() method but doenst seem to be a get_content()
>>>>method :(.
>>>>
>>>
>>
>>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]