Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing and using pseudo hash produced with xml::parser

Status
Not open for further replies.

Windrider

Programmer
Jul 26, 2002
8
FI
Hi!

I'm parsing xml -document with XML::parser with a tree style processing, which automatically puts any sub branches nested.

E.g.

<preferences>
<font role=&quot;console&quot;>
<fname>Courier</name>
<size>9</size>
</font>
<font role=&quot;default&quot;>
<fname>Times New Roman</name>
<size>14</size>
</font>
<font role=&quot;titles&quot;>
<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!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top