2015년 7월 6일 월요일

Why XML Declaration is needed?

In many XML documents, <?xml version="1.0" encoding="URF-8" standalone="no"?> is declared.

When parsing a XML doc, XML Parser uses this declaration info.
  1. "version" stands for a XML standard version which must be included in XML doc.
    (maybe, a possible version is 1.0 or 1.1.)
  2. "encoding" stands for a encoding name such as UTF-8, EUC-KR, and UTF-16.
  3. "standalone" stands for whether to use external DTD or Entity.
    If XML doc has an internal DTD, a standalone's  value is "yes".
    If XML doc is linked to an external DTD or any Entity, a standalone's value is "no".
    If "standalone" is dropped, automatically "standalone" is set "no"