[jdom-interest] CDATA data (followup with more info)

Malachi de AElfweald malachi at tremerechantry.com
Thu Nov 7 19:18:13 PST 2002


Actually, not quite.

the xml version declaration is a processor instruction.

First link under google search for `xml "processing instruction" tutorial`
brings up:
http://www.javacommerce.com/tutorial/xmlj/pi.htm

Quoted below:

Processing Instructions are information for the application. PI's allow documents to contain 
instructions for applications. They are not really of interest to the XML parser. Instead, the 
instructions are passed to the application using the parser, because the purpose of processing 
instructions is to represent special instructions for the application.

Like comments, they are not textually part of the XML document.

All processing instructions, including the XML declaration, begin with <? and end with ?>. Following 
the initial <?, you will find the name of the processing instruction. The PI begins with the PITarget 
used to identify the application to which the instruction is directed.

<?name pidata?>

<?xml version="1.0"? encoding="UTF-8" standalone="yes"?>

Version Declaration is a form of PI.

A particular document may have processing instructions for several different applications, so the 
processing instruction target (PITarget), right after the opening <?, identifies the target application 
for this processing instruction.




11/7/2002 6:41:00 AM, Elliotte Rusty Harold <elharo at metalab.unc.edu> wrote:

>>Why doesn't JDOM use the <?xml encoding="blah"?> preprocessor 
>>instruction to determine
>>what to output as?  Isn't that tag required anyways?
>
>Wrong on three counts: It's not required, it's not a tag, and it's 
>not a processing instruction. JDOM generates the appropriate *XML 
>declaration* to match the encoding you requested.
>
>JDOM hews pretty closely to the XML spec. Most of your confusion 
>seems to stem from misunderstandings about XML rather than JDOM.
>-- 
>
>+-----------------------+------------------------+-------------------+
>| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
>+-----------------------+------------------------+-------------------+
>|          XML in a  Nutshell, 2nd Edition (O'Reilly, 2002)          |
>|              http://www.cafeconleche.org/books/xian2/              |
>|  http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/  |
>+----------------------------------+---------------------------------+
>|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
>|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
>+----------------------------------+---------------------------------+
>
>






More information about the jdom-interest mailing list