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"

In most cases, we use version="1.0" although there is version 1.1.

XML 1.1 version is used for special cases which mean that rare languages (such as Mongolian, Cambodian language, etc.) are used for a markup language.
(In Korean, 레퍼런스에도 나와있지만 몽고어, 캄보디아어, 몰디브어 또는 일부 소수 언어를 마크업 언어로 사용하는 경우 XML 1.1 version을 사용한다.)




In Korean, version은 xml 문서를 나타내는 방식을 지정하는 거고, encoding은 사용된 언어, standalone은 추가 DTD 문서의 여부를 의미하는 것.



References
1. https://xmlwriter.net/xml_guide/xml_declaration.shtml
2. http://www.cafeconleche.org/books/effectivexml/chapters/03.html
3. http://yish-foss.blogspot.kr/2012/04/xml-10.html

댓글 없음:

댓글 쓰기