Hi!
I'm parsing xml -document with XML:
arser with a tree style processing, which automatically puts any sub branches nested.
E.g.
<preferences>
<font role="console">
<fname>Courier</name>
<size>9</size>
</font>
<font role="default">
<fname>Times New Roman</name>
<size>14</size>
</font>
<font role="titles">
<fname>Helvetica</name>
<size>10</size>
</font>
</preferences>
With this datafile, the it produces
$tree = [
'preferences', [
{}, 0, '\n',
'font', [
{ 'role' => 'console' }, 0, '\n',
'size', [ {}, 0, '9' ], 0, '\n',
'fname', [ {}, 0, 'Courier' ], 0, '\n'
], 0, '\n',
'font', [
{ 'role' => 'default' }, 0, '\n',
'fname', [ {}, 0, 'Times New Roman' ],0, '\n',
'size', [ {}, 0, '14' ], 0, '\n'
], 0, '\n',
'font', [
{ 'role' => 'titles' }, 0, '\n',
'size', [ {}, 0, '10' ], 0, '\n',
'fname', [ {}, 0, 'Helvetica' ], 0, '\n',
], 0, '\n',
]
];
My problem is that is there convenient way to loop the tree structure in convenient way or how to access specific parameter there.
Thank you!
I'm parsing xml -document with XML:
E.g.
<preferences>
<font role="console">
<fname>Courier</name>
<size>9</size>
</font>
<font role="default">
<fname>Times New Roman</name>
<size>14</size>
</font>
<font role="titles">
<fname>Helvetica</name>
<size>10</size>
</font>
</preferences>
With this datafile, the it produces
$tree = [
'preferences', [
{}, 0, '\n',
'font', [
{ 'role' => 'console' }, 0, '\n',
'size', [ {}, 0, '9' ], 0, '\n',
'fname', [ {}, 0, 'Courier' ], 0, '\n'
], 0, '\n',
'font', [
{ 'role' => 'default' }, 0, '\n',
'fname', [ {}, 0, 'Times New Roman' ],0, '\n',
'size', [ {}, 0, '14' ], 0, '\n'
], 0, '\n',
'font', [
{ 'role' => 'titles' }, 0, '\n',
'size', [ {}, 0, '10' ], 0, '\n',
'fname', [ {}, 0, 'Helvetica' ], 0, '\n',
], 0, '\n',
]
];
My problem is that is there convenient way to loop the tree structure in convenient way or how to access specific parameter there.
Thank you!