You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Benjamin Kolin <be...@westbridgetech.com> on 2004/04/07 22:31:41 UTC

Processing the xml declaration line

Is there some way to get the XML declaration to act like a standard
processing instruction so I can handle it with the processInstruction
callback?  I am talking about the line:
 
<?xml version="1.0" encoding="UTF-8"?>
 
If I cannot handle it as a processing instruction, can I ask the parser
for it any other way?  I cannot seem to find it in the doc.  Thanks.
 
-Ben

Re: Processing the xml declaration line

Posted by Michael Glavassevich <mr...@apache.org>.
SAX2 Extensions 1.1 exposes the encoding and version of the current entity
through the Locator2 interface. In the version of SAX being discussed on
the xml-dev list, there's a new property called document-xml-version which
returns the version of the document entity. Hopefully both Extensions 1.1
and this new minor version of SAX will be final soon. I'm currently
working on support for the extensions and new version of SAX (I'm
guessing it will be 2.0.2). The plan is to include this in the next
version of Xerces.

On Wed, 7 Apr 2004, Joseph Kesselman wrote:

> The W3C's been very explicit about the XML Declaration *NOT* being a
> Processing Instruction, even if it looks like one.
>
> DOM Level 3 Core (just announced as a Recommendation) adds calls to
> retrieve information from the XML Declaration. I'm not sure how much of it
> is available in SAX.
>
> ______________________________________
> Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
> "The world changed profoundly and unpredictably the day Tim Berners Lee
> got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org

---------------------------
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Processing the xml declaration line

Posted by Joseph Kesselman <ke...@us.ibm.com>.



The W3C's been very explicit about the XML Declaration *NOT* being a
Processing Instruction, even if it looks like one.

DOM Level 3 Core (just announced as a Recommendation) adds calls to
retrieve information from the XML Declaration. I'm not sure how much of it
is available in SAX.

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Processing the xml declaration line

Posted by Neil Delima <nd...@ca.ibm.com>.




"Benjamin Kolin" <be...@westbridgetech.com> wrote on 04/07/2004 04:31:41 PM:

> Is there some way to get the XML declaration to act like a standard
>  ...
> If I cannot handle it as a processing instruction, can I ask the
> parser for it any other way?


Hi Ben,

The Document and Entity interfaces from DOM Level 3 Core[1] (which is now a
W3C Recommendation) contain attributes named xmlEncoding[2][3] and
xmlVersion[4][5] that represent the version and encoding attributes of an
XMLDecl and TextDecl.  This might help you achieve what you want.

[1] http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html
[2]
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Document3-version
[3]
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Document3-encoding
[4]
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Entity3-version
[5]
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Entity3-encoding


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org