mirod thanks for your patience and assistance. I will explain fully the job i am doing now.

I am having an ini file in which they give conditions like shown below.

########## condition ############## <condition> <chap/<ch/<sec/<p/<anchor==<anchors </condition> ########## andcondition ############## <andcondition> <book&&<chap/<ch/<sec/<p/<para==<paragraph </andcondition> ########## orcondition ############## <orcondition> <book||<chap/<ch/<sec/<p/<ca==<caption </orcondition> ########## noncondition ############## <noncondition> <para/<author==<auth </noncondition> ########## andnoncondition ############## <andnoncondition> <book&&<chap//<anchor/<para/<it==<italics </andnoncondition> ########## ornoncondition ############## <ornoncondition> <book||<chap//<anchor/<para/<b==<bold </ornoncondition>

Now i will explain what the ini file is to do.


1. <condition>: we have to fetch that path and search in the xml file and replace 'anchor' with 'anchors' which is given after == sign.
2. <andcondition>: In and condition 'para' element should be checked in both parent 'book' and 'chap' and if it is present in both then replace 'para' with 'paragraph' which is given after == sign
3. <orcondition>: In or condition 'ca' element should be checked in both parent 'book' and 'chap' and if it is present either in one or both then replace 'para' with 'caption' which is given after == sign
4. <noncondition>: In non condition we have to fetch that path and search in the xml file and don't replace 'author' with 'auth' in that location and replace it in other locations which is given after == sign.
5. <andnoncondition>: In and non condition 'it' element should be checked in both parent 'book' and 'chap' and if it is present in both then replace 'para' with 'paragraph' in all locations except in the given path.
6. <ornoncondition>: In or non condition 'b' element should be checked in both parent 'book' and 'chap' and if it is present either in one or both then replace 'b' with 'bold' in all locations except in the given path.

I will give just a sample xml file for the above conditions. Also the tool should do from 6 to 1 ie in reverse order, <ornonconition> to <condition>.

This is my requuirement and i am doing as shown in my original node. How to do this. There will be more than one entries in each condition.

input xml

<chap> <ch> <sec> <p> <anchor><b>THE ILIAD</b></anchor> <para> <author>HOMER</author> </para> <ca>check</ca> </p> </sec> <sec> <author><it>HOMER</it></author> <p> <anchor>BOOK I</anchor> <para> Sing, O goddess, <it>the anger </it>of Achilles son of Peleu +s, that brought countless ills upon the Achaeans. </para> </p> </sec> </ch> </chap>

I apologise for such long post.

Regards,
Anniyan
(CREATED in HELL by DEVIL to s|EVILS|GOODS|g in WORLD)


In reply to Re^4: XML::Twig question by anniyan
in thread XML::Twig question by anniyan

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.