This part of your XML is likely to cause you trouble:

<chapter>sathish <subchap1>sathish is good boy or not <p>sathish is a good bou</p>

The <chapter> element contains what is called 'mixed content' - a mixture of text and other elements. There is nothing inherently wrong with mixed content (XHTML for example uses it extensively) as long as you choose appropriate tools to work with it. XML::Simple is not an appropriate module for working with mixed content - it says as much in the documentation.

You might consider changing your XML to something like:

<chapter><title>sathish</title> <subchap1><title>sathish is good boy or not</title> <p>sathish is a good bou</p>

Even once you have done this, I still would not recommend XML::Simple for the job. Consider reading this article on Stepping up from XML::Simple to XML::LibXML.


In reply to Re: xml tag mapping? by grantm
in thread xml tag mapping? by satzbu

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.