hello, I am trying to generate an XML document in the following form:
<ROOT> <Child1> <SubChild1>xxx</SubChild1> <SubChild2>xxx</SubChild2> <SubChild3>xxx</SubChild3> </Child1> <Child2> <SubChild1>xxx</SubChild1> <SubChild2>xxx</SubChild2> <SubChild3>xxx</SubChild3> <SubChild4>xxx</SubChild4> <SubChild> <SubSubChild1>xxx</SubSubChild1> <SubSubChild2>xxx</SubSubChild2> <SubSubChild3>xxx</SubSubChild3> <SubSubChild4>xxx</SubSubChild4> <SubSubChild5>xxx</SubSubChild5> <SubSubChild6>xxx</SubSubChild6> </SubChild> <SubChild5>xxx</SubChild5> </Child2> </ROOT>
I have done it just by reading my data in from a csv file, but I was wondering if there is a perl module that could help me do this. Also, the <Child2> section can be repeated depending on my data that I have passed in. So it could look like:
<ROOT> <Child1> <SubChild1>xxx</SubChild1> <SubChild2>xxx</SubChild2> <SubChild3>xxx</SubChild3> </Child1> <Child2> <SubChild1>xxx</SubChild1> <SubChild2>xxx</SubChild2> <SubChild3>xxx</SubChild3> <SubChild4>xxx</SubChild4> <SubChild> <SubSubChild1>xxx</SubSubChild1> <SubSubChild2>xxx</SubSubChild2> <SubSubChild3>xxx</SubSubChild3> <SubSubChild4>xxx</SubSubChild4> <SubSubChild5>xxx</SubSubChild5> <SubSubChild6>xxx</SubSubChild6> </SubChild> <SubChild5>xxx</SubChild5> </Child2> <Child3> <SubChild1>xxx</SubChild1> <SubChild2>xxx</SubChild2> <SubChild3>xxx</SubChild3> <SubChild4>xxx</SubChild4> <SubChild> <SubSubChild1>xxx</SubSubChild1> <SubSubChild2>xxx</SubSubChild2> <SubSubChild3>xxx</SubSubChild3> <SubSubChild4>xxx</SubSubChild4> <SubSubChild5>xxx</SubSubChild5> <SubSubChild6>xxx</SubSubChild6> </SubChild> <SubChild5>xxx</SubChild5> </Child3> </ROOT>
any help, or an example on how to use a perl module to do this would be great. I have been playing around with XML::DOM, but am not having lots of luck. thanks again

In reply to Generating an XML Document by Arcane

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.