I have a small perl testing application which glups XML data. All these days I was using XML::Mini Parser, since the XML::Mini has DOM kind of API.

Now I have decided to use SAX based parser (XML::Parser::PerlSAX).
I see in SAX approach the data is collected via call back functions.

This call back thing has made me to re-design stuff, that is call all the rest of the logic from these call back functions, which I don;t want to do.

Instead, I want to read the XML bit by bit and parse it. So I decided to open() the file and read() it.
From the XML::Parser::PerlSAX documentation I found that this module has a method named:

XML::Parser::PerlSAX->location() which returns:

BytePosition The current byte position of the parse.
I am very much intrested in this attribute "BytePosition", I can say, my rest of the logic is depended on this "BytePosition". But unfortunately I din;t find direct method to consume this XML::Parser::PerlSAX->location() function.
The questions I have is:

1. Are there any internel hooks that can return the "BytePosition - The current byte position of the parse."
2. How to lazy evaluate call-back routines of XML::Parser::PerlSAX to fetch limited data on request?


In reply to XML-Parser-PerlSAX how to get the BytePosition value by harsha.reddy

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.