G'day most honorable Monks,

I have a problem that is obviously above my head and I would really appreciate a push start getting it solved.

I generate the Original_Group.xml using SQL and Perl but because this is outside the applications capability to create its own export/import XML with a parent/child Group relationships so I am having to make this up as I go.

The Sorted_Group.xml is the manual manipulation that is required of the Perl parser I am trying to build.

The resulting Sorted_Group.xml requires that a Group record be Inserted only if it does not contain any Sub-Group members or that a defined Sub-Group member(s) already exists (inserted previously) before it will be allowed to be inserted.

Just not sure how to handle sorting with multiple levels of members in the xml record.

Any and all help is greatly appreciated.

Thanks,
Danny

Original_Group.xml
<SystemXchange version="1.0"> <summary> <tool version="2.8 build: [070207]">Enterprise Migration Tool< +/tool> <source></source> <timestamp>May 30, 2008 @ 10:00:00 CDT</timestamp> </summary> <!--Begin Group Records--> <records type="group" operation="insert"> <record> <name>GOLF</name> <members> <Group>ECHO</Group> <Group>BETA</Group> <Group>DELTA</Group> <Group>FOXTROT</Group> </members> </record> <record> <name>ECHO</name> <members> <Group>CHARLIE</Group> <Group>DELTA</Group> </members> </record> <record> <name>CHARLIE</name> <members> <Group>ALPHA</Group> <Group>DELTA</Group> </members> </record> <record> <name>BETA</name> <members> <Group>FOXTROT</Group> <Group>CHARLIE</Group> </members> </record> <record> <name>FOXTROT</name> <members> <Group>ALPHA</Group> </members> </record> <record> <name>DELTA</name> <members> <Group>ALPHA</Group> <Group>FOXTROT</Group> </members> </record> <record> <name>ALPHA</name> <members> </members> </record> </records> </SystemXchange>


Sorted_Group.xml
<SystemXchange version="1.0"> <summary> <tool version="2.8 build: [070207]">Enterprise Migration Tool< +/tool> <source></source> <comments> </comments> <timestamp>May 30, 2008 @ 10:00:00 CDT</timestamp> </summary> <!--Begin Group Records--> <records type="group" operation="insert"> <record> <name>ALPHA</name> <members> </members> </record> <record> <name>FOXTROT</name> <members> <Group>ALPHA</Group> </members> </record> <record> <name>DELTA</name> <members> <Group>ALPHA</Group> <Group>FOXTROT</Group> </members> </record> <record> <name>CHARLIE</name> <members> <Group>ALPHA</Group> <Group>DELTA</Group> </members> </record> <record> <name>BETA</name> <members> <Group>FOXTROT</Group> <Group>CHARLIE</Group> </members> </record> <record> <name>ECHO</name> <members> <Group>CHARLIE</Group> <Group>DELTA</Group> </members> </record> <record> <name>GOLF</name> <members> <Group>ECHO</Group> <Group>BETA</Group> <Group>DELTA</Group> <Group>FOXTROT</Group> </members> </record> </records> </SystemXchange>

In reply to Parent/Child Group Relationship in XML Imports by onegative

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.