File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Versioning in XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Versioning in XML" Watch "Versioning in XML" New topic

Versioning in XML

N Jain

Joined: Mar 26, 2001
Posts: 7
It is said abt XML that it is open standard and there is nothing like versioning of XML (unlike HTML 3.2 HTML 4.0 etc.). So why do we write <?xml version="1.0"?> at the beginning of every XML doc?
Thanks in advance for the reply,
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
The declaration part in XML is actually optional. But it's a good idea to include it whenever you create an XML file. The declaration should have the version number, at a minimum, and ideally the encoding as well. That standard simplifies things if the XML standard is extended in the future, and if the data ever needs to be localized for different geographical regions.

Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
Ajith Kallambella

Joined: Mar 17, 2000
Posts: 5782
Not to forget, some parsers actually use the version tag to check the compatibility even before looking at the other elements.
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.

Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
According to you some parsers use version tag to check compatibilty. In case the parser doesn't finds the version tag, will it give an error?
I agree. Here's the link:
subject: Versioning in XML
jQuery in Action, 3rd edition