Yuck?  WTF?  Its beautiful!  Maybe I should explain some more.

I followed the same links you described and realized that without some
hacking in and around XMLScanner getting the BinInputStream from the
ReaderMgr is a no go.  BTW, getting at XMLScanner from a parser would be
real handy for lots of these kind of reasons.  

BUT, if you write your own file/mem InputSource that caches away its
BinInputStream you can get at it from you sax event handler:

class cSuperFastMemInputSource : public MemBufInputSource
{
        BinInputStream* MemBufInputSource::makeStream() const
        {
         if (fMemStream = null)
         {
            fMemStream = new BinMemInputStream(fSrcBytes, fByteCount, 

             fCopyBufToStream ? BinMemInputStream::BufOpt_Copy :

                                inMemInputStream::BufOpt_Reference);
         }
         return fMemStream;
      }
};


Have your SaxEvent handler class:

class mysaxeEvents : public DocumentHandler
{
    cSuperFastMemInputSource *fstrm;

    mysaxeEvents(cSuperFastMemInputSource  *strm)
    {
         fstrm = strm;
    }
    virtual void startElement(const XMLCh* const name, AttributeList& attrs)
    {
      int whereAmI = fstrm->curPos();
    }   
};


Jim


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 23, 2002 4:38 PM
> To: [EMAIL PROTECTED]
> Subject: Re: how to access the raw text that generated a sax event
> 
> 
> "Murphy, James" <[EMAIL PROTECTED]> writes:
> 
> > BinInputStream::curPos() const; looks promising since the built in
> > input sources actually implement it!  So you should be able to call
> > this in your SAX event handler methods if you provide your event
> > handler class with the InputSource you use to parse.
> 
> Yuck!!
> 
> The InputSource creates the BinInputStream which is maintained by an
> XMLReader. 
> 
> The XMLReader is maintained by a ReaderMgr.
> 
> The ReaderMgr is maintained by an XMLScanner.
> 
> All the *Parser's inherit from XMLScanner.
> 
> But...
> 
> XMLReader has no public method to access the BinInputStream, which
> doesn't really matter because even though ReaderMgr *does* have a
> public interface to access the current XMLReader, XMLScanner has *no*
> public interface to acces the ReaderMgr.
> 
> Ok.
> 
> There has to be a legitimate way to access the BinInputStream in the
> current XMLReader! Tinny are you willing to accept a patch that
> provides the two public getter methods that are needed to do this?
> 
>   XMLScanner::getReaderMgr()
> 
> and 
> 
>   XMLReader::getBinInputStream()
> 
> are what I see. Or is there something I'm missing?
> 
> Thanks,
> jas.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to