Hi Monks,

I try to check well-form of the XML file(without entity expanstion, using "NoExpand" option), it is not working what is the problem?

Updated: I need this, if entity is appeared in that XML file, that declaration should be ignored. What is the way to do this?

<!ENTITY e SYSTEM “e.xml”> For example, &e; should not be replaced with corresponding entity.
I try with below code

use XML::Parser; my $xmlfile = do {local $/, <DATA>}; my $parser = XML::Parser->new( ErrorContext => 2, NoExpand => 1 ); eval { $parser->parsefile( $xmlfile ); }; if( $@ ) { print STDERR "\nERROR in '$xmlfile':\n$@\n"; } else { print STDERR "'$xmlfile' is well-formed\n"; } __DATA__ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE test [ <!ENTITY e SYSTEM "a.pl"> ]> <test> <customer> <first-name>J&e;oe</first-name> <surname>Wrigley</surname> <address> <street>17 Be&#x00DC;able Ave.</street> <city>Meatball</city> <state>MI</state> <zip>82649</zip> </address> <email>joewrigley@jmac.org</email> <age>42</age> </customer> <customer> <first-name>Henrietta</first-name> <surname>Pussycat</surname> <address> <street>R.F.D. 2</street> <city>Flangerville</city> <state>NY</state> <zip>83642</zip> </address> <email>meow@263A.org</email> <age>37</age> </customer> </test>

Thanks
Balaji. M


In reply to NoExpand option in XML::Parser by msbalaji

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.