Thanks for the code. The problem with using this is that the XML file I am working on is 300 mb and highly nested. Each child has diffrent levels of nesting. The if else would be tedious to use.
My other question
What if I had nested children within nested children? What would be the most efficient to do it? For example how do I access the elements of elt for each C? My 2nd question is about how I could display these elements like
The book of pages|Snap|Line1|Line2|Line3|Line4|Line5|C1.X|
The book of pages|Snap|Line1|Line2|Line3|Line4|Line5|C1.Y|
The book of pages|Snap|Line1|Line2|Line3|Line4|Line5|C2.X|
The book of pages|Snap|Line1|Line2|Line3|Line4|Line5|C2.Y|
The book of pages|Snap|Line1|Line2|Line3|Line4|Line5|C3.X|
The book of pages|Snap|Line1|Line2|Line3|Line4|Line5|C3.Y|
.
.
.
.
.
The song|Snap|Line1|Line2|Line3|Line4|Line5|C2.X|
The song|Snap|Line1|Line2|Line3|Line4|Line5|C2.Y|
Example
<Rating>
<C1>
<elt>
<X></X>
<X></X>
</elt>
<elt>
<elt>
</C1>
<C2>
<elt>
<elt>
<elt>
</C2>
<C3>
<elt>
<elt>
<elt>
</C3>
</Rating>
Is there another XML module that can be more helpful than XML::Twig for this purpose?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.