You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Elisha Berns <e....@computer.org> on 2005/10/02 22:47:39 UTC

How to get encoding declaration from
Hi,

How do you get the encoding=xxx declaration from the <?xml ...?>
declaration of an xml document using Xerces? I'd like to use SAX to do
it, but I don't see an interface that that has a getEncoding() method so
far that works off the xml document.

Additionally the DefaultHandler::startPrefixMapping() method has a note
in the documentation that says, "The current Implementation of
SAX2Parser will _NEVER_ call this".  So is there some other built in way
to get the prefix mappings?

Thanks for any help here,

Elisha Berns
e.berns@computer.org
tel. (310) 556 - 8332
fax (310) 556 - 2839




---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: How to get encoding declaration from Posted by Alberto Massari <am...@datadirect.com>.
Hi Elisha,
you can try installing an "advanced document handler" using 
installAdvDocHandler(); in your XMLDocumentHandler-derived class, you 
will receive the <?xml... declaratin through the XMLDecl method

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

As for the startPrefixMapping documentation, it was outdated: the 
parser does indeed call it.

Alberto

At 13.47 02/10/2005 -0700, Elisha Berns wrote:
>Hi,
>
>How do you get the encoding=xxx declaration from the <?xml ...?>
>declaration of an xml document using Xerces? I'd like to use SAX to do
>it, but I don't see an interface that that has a getEncoding() method so
>far that works off the xml document.
>
>Additionally the DefaultHandler::startPrefixMapping() method has a note
>in the documentation that says, "The current Implementation of
>SAX2Parser will _NEVER_ call this".  So is there some other built in way
>to get the prefix mappings?
>
>Thanks for any help here,
>
>Elisha Berns
>e.berns@computer.org
>tel. (310) 556 - 8332
>fax (310) 556 - 2839
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>For additional commands, e-mail: c-dev-help@xerces.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org