[PHP] Re: DOMElement::setAttribute() manual example question

2006-03-05 Thread Rob
Andreas Korthaus wrote: $node = new DOMElement("root"); is read only, while $node = $doc->createElement("root"); is not? Why? $node = new DOMElement("root"); In this case the element is not associated with a document. In DOM, you really aren't supposed to have a node not associated with an

[PHP] Re: DOMElement::setAttribute() manual example question

2006-03-05 Thread Andreas Korthaus
Hi Rob! Rob wrote: createElement("root"); $node->setAttribute("align", "left"); $doc->appendChild($node); echo $doc->saveXML(); ?> Both ways are perfectly valid. $node and $newnode refer to the same object. It was written the 1st way to demonstrate the return value of appendChild(), because

Re: [PHP] Re: DOMElement::setAttribute() manual example question

2006-03-03 Thread Gustav Wiberg
- Original Message - From: "Rob" <[EMAIL PROTECTED]> To: "Gustav Wiberg" <[EMAIL PROTECTED]> Cc: "Andreas Korthaus" <[EMAIL PROTECTED]>; Sent: Friday, March 03, 2006 8:04 PM Subject: Re: [PHP] Re: DOMElement::setAttribute() manual exam

Re: [PHP] Re: DOMElement::setAttribute() manual example question

2006-03-03 Thread Rob
Gustav Wiberg wrote: Check out: http://de3.php.net/manual/en/function.dom-domdocument-createelement.php ( This function creates a new instance of class DOMElement. This node will not show up in the document unless it is inserted with e.g. DOMNode->appendChild().) I really don't understand WH

Re: [PHP] Re: DOMElement::setAttribute() manual example question

2006-03-03 Thread Gustav Wiberg
- Original Message - From: "Rob" <[EMAIL PROTECTED]> To: "Andreas Korthaus" <[EMAIL PROTECTED]> Cc: Sent: Friday, March 03, 2006 4:43 PM Subject: [PHP] Re: DOMElement::setAttribute() manual example question Andreas Korthaus wrote: Hi! I'v

[PHP] Re: DOMElement::setAttribute() manual example question

2006-03-03 Thread Rob
Andreas Korthaus wrote: Hi! I've a question regarding the example in DOMElement::setAttribute() chapter of the PHP manual: http://de3.php.net/dom-domelement-setattribute There, an attribute is added to an element this way: createElement("root"); $newnode = $doc->appendChild($node); $newnode-