You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Tony Palmer <to...@vordel.com> on 2004/03/19 18:03:48 UTC

XML encoding

Hi,
I need to obtain the xml encoding from the underlying document after is
is parsed.
I note that the Xerces DOMDocumentImpl has the methods 
     virtual const XMLCh*         getEncoding() const;
     virtual const XMLCh*         getActualEncoding() const;
 
Looking at files in  XalanDOM, XercesParserLiaison and XalanSourceTree
there appears to be no way to obtain this using the Xalan document. I'm
assuming that there might be no encoding attribute in the xml-decl and
that the encoding could be obtained just from the bom and not defaulted
to UTF-8.
How can I obtain the endoding (via Xalan)? 
I am using  the excellent Xalan-C_1_6_0 and xerces-c_2_3_0
Many regards,
Tony

Re: XML encoding

Posted by John Gentilin <ge...@eyecatching.com>.
Tony,

I am working with the underlying document in Xalan-J. I used
the Xerces parser outside of Xalan and passed in a DOMSource
for both my stylesheet and data source. There does not seem
to be too much of a performance issue but I am using smaller
document <30K and I am not doing any transaction processing
so +- 250ms and I would never notice.

-John G

Tony Palmer wrote:
> Thanks for the answer David, I sort of guessed it could not be obtained in
> this way.
> Any hints on how it could be obtained with the least amount of change to
> Xalan?
> e.g. (ab)using the transcoding functionality?
> Tony
> 
> -----Original Message-----
> From: david_n_bertoni@us.ibm.com [mailto:david_n_bertoni@us.ibm.com]
> Sent: 19 March 2004 17:22
> To: xalan-dev@xml.apache.org
> Subject: Re: XML encoding
> 
> 
> 
> 
> 
> 
> Hi Tony,
> 
> The original encoding of the source document is not part of the XPath data
> model, so it is not available.  Since the SAX API does not report this
> information, it's impossible for Xalan-C to recover and store this
> information, even if we wanted to.
> 
> Dave
> 
> 
> 
> |---------+--------------------------->
> |         |           "Tony Palmer"   |
> |         |           <tony@vordel.com|
> |         |           >               |
> |         |                           |
> |         |           03/19/2004 09:03|
> |         |           AM              |
> |         |           Please respond  |
> |         |           to xalan-dev    |
> |---------+--------------------------->
> 
>>---------------------------------------------------------------------------
> 
> -----------------------------------------------------------------------|
>   |
> |
>   |        To:      <xa...@xml.apache.org>
> |
>   |        cc:      (bcc: David N Bertoni/Cambridge/IBM)
> |
>   |        Subject: XML encoding
> |
> 
> 
>>---------------------------------------------------------------------------
> 
> -----------------------------------------------------------------------|
> 
> 
> 
> Hi,
> I need to obtain the xml encoding from the underlying document after is is
> parsed.
> I note that the Xerces DOMDocumentImpl has the methods
>      virtual const XMLCh*         getEncoding() const;
>      virtual const XMLCh*         getActualEncoding() const;
> 
> Looking at files in  XalanDOM, XercesParserLiaison and XalanSourceTree
> there appears to be no way to obtain this using the Xalan document. I'm
> assuming that there might be no encoding attribute in the xml-decl and that
> the encoding could be obtained just from the bom and not defaulted to
> UTF-8.
> How can I obtain the endoding (via Xalan)?
> I am using  the excellent Xalan-C_1_6_0 and xerces-c_2_3_0
> Many regards,
> Tony




RE: XML encoding

Posted by Tony Palmer <to...@vordel.com>.
Thanks for the answer David, I sort of guessed it could not be obtained in
this way.
Any hints on how it could be obtained with the least amount of change to
Xalan?
e.g. (ab)using the transcoding functionality?
Tony

-----Original Message-----
From: david_n_bertoni@us.ibm.com [mailto:david_n_bertoni@us.ibm.com]
Sent: 19 March 2004 17:22
To: xalan-dev@xml.apache.org
Subject: Re: XML encoding






Hi Tony,

The original encoding of the source document is not part of the XPath data
model, so it is not available.  Since the SAX API does not report this
information, it's impossible for Xalan-C to recover and store this
information, even if we wanted to.

Dave



|---------+--------------------------->
|         |           "Tony Palmer"   |
|         |           <tony@vordel.com|
|         |           >               |
|         |                           |
|         |           03/19/2004 09:03|
|         |           AM              |
|         |           Please respond  |
|         |           to xalan-dev    |
|---------+--------------------------->

>---------------------------------------------------------------------------
-----------------------------------------------------------------------|
  |
|
  |        To:      <xa...@xml.apache.org>
|
  |        cc:      (bcc: David N Bertoni/Cambridge/IBM)
|
  |        Subject: XML encoding
|

>---------------------------------------------------------------------------
-----------------------------------------------------------------------|



Hi,
I need to obtain the xml encoding from the underlying document after is is
parsed.
I note that the Xerces DOMDocumentImpl has the methods
     virtual const XMLCh*         getEncoding() const;
     virtual const XMLCh*         getActualEncoding() const;

Looking at files in  XalanDOM, XercesParserLiaison and XalanSourceTree
there appears to be no way to obtain this using the Xalan document. I'm
assuming that there might be no encoding attribute in the xml-decl and that
the encoding could be obtained just from the bom and not defaulted to
UTF-8.
How can I obtain the endoding (via Xalan)?
I am using  the excellent Xalan-C_1_6_0 and xerces-c_2_3_0
Many regards,
Tony


Re: XML encoding

Posted by da...@us.ibm.com.



Hi Tony,

The original encoding of the source document is not part of the XPath data
model, so it is not available.  Since the SAX API does not report this
information, it's impossible for Xalan-C to recover and store this
information, even if we wanted to.

Dave



|---------+--------------------------->
|         |           "Tony Palmer"   |
|         |           <tony@vordel.com|
|         |           >               |
|         |                           |
|         |           03/19/2004 09:03|
|         |           AM              |
|         |           Please respond  |
|         |           to xalan-dev    |
|---------+--------------------------->
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                                  |
  |        To:      <xa...@xml.apache.org>                                                                                                       |
  |        cc:      (bcc: David N Bertoni/Cambridge/IBM)                                                                                             |
  |        Subject: XML encoding                                                                                                                     |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|



Hi,
I need to obtain the xml encoding from the underlying document after is is
parsed.
I note that the Xerces DOMDocumentImpl has the methods
     virtual const XMLCh*         getEncoding() const;
     virtual const XMLCh*         getActualEncoding() const;

Looking at files in  XalanDOM, XercesParserLiaison and XalanSourceTree
there appears to be no way to obtain this using the Xalan document. I'm
assuming that there might be no encoding attribute in the xml-decl and that
the encoding could be obtained just from the bom and not defaulted to
UTF-8.
How can I obtain the endoding (via Xalan)?
I am using  the excellent Xalan-C_1_6_0 and xerces-c_2_3_0
Many regards,
Tony