Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why is there a "?" in the beginning of an xml document

 
Joe May
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Was just wondering.. is there any logical reason for the "?" at the beginning of an xml document?

<?xml version="1.0 encoding="some_encoding">

Thanks
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is the format required by the standard. One function is to tell the parser that the < does not start a normal tag.

See also the use of special characters in the format for comments and DOCTYPE declarations.

Bill
 
g tsuji
Ranch Hand
Posts: 669
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read carefully: <? opening tag, ?> closing tag. The simple line contains already two mistakes (another is version, a genuine typo, possibly).
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic