473,394 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

DOM question - visiting a node's children?

As of PHP 5.1, why aren't there functions that return a node's
children, a node's first/last/nth child, a node's parent/previous
sibling/next sibling, etc., as in the DOM specification? How are you
currently meant to traverse a DOM tree without these functions? Or
perhaps they exist somewhere in the documentation, but not under the
list of DOM functions - if so, where are they?

Rodney

May 16 '06 #1
5 1705
r_*****@yahoo.com wrote:
As of PHP 5.1, why aren't there functions that return a node's
children, a node's first/last/nth child, a node's parent/previous
sibling/next sibling, etc., as in the DOM specification? How are you
currently meant to traverse a DOM tree without these functions? Or
perhaps they exist somewhere in the documentation, but not under the
list of DOM functions - if so, where are they?

Rodney


Hi Rodney,

That is like asking: "Where are the rocket blueprints for the Saturn5 in
PHP?"

PHP is executed at the server, and returns a response, which can be HTML.
If you want to use DOM-specific functionality, this is executed by the
browser that receives the HTML produced by PHP.

PHP is completely out-of-touch with the HTML it delivered.

You need Javascript to access DOM in a browser.

Of course, this doesn't mean PHP cannot be used to deliver nice
Javascript/HTML/etc, but PHP is NOT in charge anymore once the HTML arrives
at some client (browser).

Regards,
Erwin Moller
May 16 '06 #2
"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:44***********************@news.xs4all.nl...
r_*****@yahoo.com wrote:
As of PHP 5.1, why aren't there functions that return a node's
children, a node's first/last/nth child, a node's parent/previous
sibling/next sibling, etc., as in the DOM specification? How are you
currently meant to traverse a DOM tree without these functions? Or
perhaps they exist somewhere in the documentation, but not under the
list of DOM functions - if so, where are they?

Rodney


Hi Rodney,

That is like asking: "Where are the rocket blueprints for the Saturn5 in
PHP?"

PHP is executed at the server, and returns a response, which can be HTML.
If you want to use DOM-specific functionality, this is executed by the
browser that receives the HTML produced by PHP.

PHP is completely out-of-touch with the HTML it delivered.

You need Javascript to access DOM in a browser.


While I agree with the fact that the question was a bit odd, I think it
could actually mean another DOM tree, such as an XML DOM instead of HTML.
Perhaps the original poster is referring to some XML parser, who knows.
Point is that HTML isn't the only possibility here.

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
May 16 '06 #3
Yes, I'm talking about XML DOM. See Section VI-XXX. DOM Functions and
SectionVI-CLXVIII. XML Parser Functions, etc. As I understand it, all
these functions are used in PHP scripts on the server to process XML
documents as DOM trees in memory. (I'm not referring to HTML DOM which
is indeed used by JavaScript on the client.)

May 16 '06 #4
tim

Rodney Topor wrote:
Yes, I'm talking about XML DOM. See Section VI-XXX. DOM Functions and
SectionVI-CLXVIII. XML Parser Functions, etc. As I understand it, all
these functions are used in PHP scripts on the server to process XML
documents as DOM trees in memory. (I'm not referring to HTML DOM which
is indeed used by JavaScript on the client.)


Hi Rodney

In the DOM functions childNodes,first/lastChild and parentNode are
properties of DomNodes

They are listed in the table just below the function list
http://www.php.net/manual/en/ref.dom....class.domnode

You're not the only one who a problem finding them. I searched the
table of contents for ages wondering how I could use a dom without
childNodes...

Tim

May 16 '06 #5
Tim, Thank you! That answers my question. Glad to learn I am not
alone. Case closed!

Rodney

May 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeff | last post by:
I'd like to write an XPath expression that gets a node with 2 particular children. I thought this would work: /AAA/BBB/CCC/following-silbing::DDD/parent::node() on xml like this: AAA BBB
1
by: Ha | last post by:
I am trying to move a node of a tree up one level. Example: I want to move C to be a child of A, then remove B. Before: <A> <B> <C> <D/> <E/> </C>
8
by: Ryan Stewart | last post by:
Putting the following code in a page seems to make it go into an infinite loop unless you give it a very simple node to work with. Either that or it's very very slow. I'm somewhat new to this,...
2
by: Urs Vogel | last post by:
Hi When using XmlDocument, I can create nodes and attributes as I like. What I didn't achieve is changing the Value of a node (created with createElement), it claims that it's the wrong node...
3
by: Brian Henry | last post by:
If i already have a tree view created, and want to add another new node to it, how would i do so? Is there a way to throught tags or anything? like i have this RootNode | +-- Child 1 +--...
8
by: Don Wash | last post by:
Hi There! I'm using VB.NET to create a TreeView application and unfortunately I could not find "Key" property in Node items of the TreeView. We used to have "Key" property in TreeView node...
4
by: Tom | last post by:
Hello everyone, I found a frustrating behavior in the TreeView control in .NET 2.0. The TreeNode that is passed in the TreeNodeMouseClickEventArgs is incorrect when the TreeView automatically...
0
by: Guzeppi | last post by:
Hi, i'm using linq to load an xml structure into my classes. the xml consists of the same node nested for multiple levels e.g. <node id="node_id01" name="node 01"> <node id="node_id0101"...
9
MrPickle
by: MrPickle | last post by:
I have a structure like so: struct node { float x, y, z; std::vector<node> children; }; and I want to loop through all the node's children, then all the children's children then all the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.