I need to know the real position where xml declaration is ended.
I use my own class which should resolve this task (see the pseudo code
below)

class XmlInfoParser : public SAXParser, public HandlerBase
{
public:

    XmlInfoParser();

    virtual void XMLDecl(
        const XMLCh* const versionStr,
        const XMLCh* const encodingStr,
        const XMLCh* const standaloneStr,
        const XMLCh* const actualEncStr
    );

    virtual void setDocumentLocator( const Locator* const locator);

private:
    const Locator*  m_locator;
};

//--------------------------------------------------------------------
// Keeps the Locator
//--------------------------------------------------------------------
void XmlInfoParser::setDocumentLocator(   const Locator* const locator)
{
    m_locator = locator;
}

//--------------------------------------------------------------------
// In this function I'm getting the last XMLDecl position
//--------------------------------------------------------------------
void XmlInfoParser::XMLDecl(
    const XMLCh* const versionStr,
    const XMLCh* const encodingStr,
    const XMLCh* const standaloneStr,
    const XMLCh* const actualEncStr )
{

    unsigned int pos = m_locator->getColumnNumber();
}

The problem occurs, when I'm parsing the XML document in UTF-16 encoding
.< ? x m l  v e r s i o n = " 1 . 0 "  e n c o d i n g = " U T F - 1 6 "  ?
>

I expected the Locator to return the last position in bytes (84). But It
returns me 42.
That may be correct if think in terms of chars.

So the question: What should I really get ?

P/S
In the old version, I got this info via additional two parameters
                                const unsigned int startSrcOfs,
                                const unsigned int endSrcOfs
that always provided the byte position (84)







Peter A. Volchek
Software Engineer
Metis International, Inc.
[EMAIL PROTECTED]



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

Reply via email to