Hi,
Did some more tweaking and if we create a new element for each node
ther is no need to clone, saves a few lines of code :)
function parseBranch($branch, &$doc, &$parent)
{
foreach ($branch as $key => $val) {
switch ($key) {
// parent attribute
Hi,
Friday, July 11, 2003, 4:30:41 AM, you wrote:
MG> Well I've made a signifigant improvement to this function, and it's now the
MG> parsing operation is only something like 26 lines. It works flawlessly (so
MG> far) for XML that does not have repeat element names on the same level.
MG> Which se
Well I've made a signifigant improvement to this function, and it's now the
parsing operation is only something like 26 lines. It works flawlessly (so
far) for XML that does not have repeat element names on the same level.
Which seems to be bad form anyway, using similar element names and
distingu
Interesting -- the clone_node() function does make certain that each element
gets its own representation in the output, for any XML I tested. I guess
then my problem lies with how I'm looping through the aforementioned array
structure to get the values themselves.
Thanks,
--
Matt Grimm
Web Develo
The array structure is the one suggested on the xml_parse_into_struct page
user comments. Our example XML would parse into this:
Array
(
[ROOTELEMENT] => Array
(
[0] => Array
(
[ATTRIBUTES] => Array
(
Hi,
Thursday, July 10, 2003, 6:44:55 AM, you wrote:
MG> Tom:
MG> Thanks for the help. Using the array setup you described, I end up with the
MG> value of each "record" node being appended to a single instance of the
MG> parent node. And that single instance of the parent node is the final one
M
Hi,
Thursday, July 10, 2003, 6:44:55 AM, you wrote:
MG> Tom:
MG> Thanks for the help. Using the array setup you described, I end up with the
MG> value of each "record" node being appended to a single instance of the
MG> parent node. And that single instance of the parent node is the final one
M
Tom:
Thanks for the help. Using the array setup you described, I end up with the
value of each "record" node being appended to a single instance of the
parent node. And that single instance of the parent node is the final one
that was parsed (the attributes verify this). The example I used belo
Hi,
Wednesday, July 9, 2003, 10:38:22 AM, you wrote:
MG> I'm having trouble creating objects with DOMXML. As I loop through a level
MG> of nodes, I'm creating a new element based on the array's key name. The XML
MG> might look like this:
MG>
MG> Value 1
MG> Value 2
MG>
MG> So I'd be doin
8 AM
To: [EMAIL PROTECTED]
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:
Value 1
Value 2
So I'd be doing this
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:
Value 1
Value 2
So I'd be doing this with DOMXML in a loop:
$thisChild = $doc->create_element($key);
$thisChild = $
11 matches
Mail list logo