aspose file tools*
The moose likes XML and Related Technologies and the fly likes why is there a Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "why is there a "?" in the beginning of an xml document" Watch "why is there a "?" in the beginning of an xml document" New topic
Author

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

Joe May
Greenhorn

Joined: Sep 28, 2009
Posts: 22
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

Joined: Mar 22, 2000
Posts: 12682
    
    5
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

Java Resources at www.wbrogden.com
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 464
    
    2
Read carefully: <? opening tag, ?> closing tag. The simple line contains already two mistakes (another is version, a genuine typo, possibly).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why is there a "?" in the beginning of an xml document
 
Similar Threads
Tomcat stopped working again!
Content is not allowed in prolog
Removing XML declaration in XML file
Parsing an Xml file with No xml Declaration
Unicode characters - javax . xml . transform . Transformer