Ask a Question related to PHP Development, Design and Development.
-
Martin Towell #1
RE: [PHP] Object assignment
Since I can't see the source for append_child(), I'll assume you're using
the $key as the index??
If so, try changing it to just a numeric index, ie, 0, 1, 2, etc.
HTH
Martin
-----Original Message-----
From: Matt Grimm [mailto:mgrimm@healthtvchannel.org]
Sent: Wednesday, 9 July 2003 10:38 AM
To: [email]php-general@lists.php.net[/email]
Subject: [PHP] Object assignment
I'm having trouble creating objects with DOMXML. As I loop through a level
of nodes, I'm creating a new element based on the array's key name. The XML
might look like this:
<rootElement>
<record id="1">Value 1</record>
<record id="2">Value 2</record>
</rootElement>
So I'd be doing this with DOMXML in a loop:
$thisChild = $doc->create_element($key);
$thisChild = $ancestor->append_child($thisChild);
Where $key is 'record' in this example, and $ancestor is 'rootElement',
which is carried along in the function.
The problem that when I reach the second element by the same name, and in
the same node level, I'm overwriting the $thisChild object that I just
created. How can I dynamically name these objects so that I can have an
indeterminate number of elements by the same name, in the same level?
Source:
http://www.healthtvchannel.org/test/php2xml.phps
Thanks,
--
Matt Grimm
Web Developer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Parkway
Anchorage, AK 99508
907.770.6200 ext. 686
907.336.6205 (fax)
E-mail: mgrimm@healthtvchannel.org
Web: www.healthtvchannel.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__________ Information from NOD32 1.452 (20030703) __________
This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com
Martin Towell Guest
-
Help with an assignment.
I'm working out of the textbook, Macromedia Dreamweaver MX Dynamic Applications, Advanced, Training from the Source, by Jeffrey Bardzell. I'm on... -
Old style assignment
I got the following warning. Can anyone tell me what the new style is? TIA!!! resp, data = h.get('/index.html', nil ) net/http: warning: old... -
Assignment
Hi - I am taking a course and am supposed to send a message to the newsgroup. This is it. Hans -
Object assignment
I'm having trouble creating objects with DOMXML. As I loop through a level of nodes, I'm creating a new element based on the array's key name. The... -
Parallel Assignment # a,b=c,d=1,2
If you are really willing to use a replacement for yacc/bison, what about: http://www.antlr.org/pccts133.html Cheers, Sam Quoteing...



Reply With Quote

