주 메뉴 열기

바뀜

2,075 바이트 추가됨 ,  6년 전
편집 요약 없음
잘 구성됨에 더하여, XML 문서에는 유효성(''validity'')이라는 것이 있다. 이는 문서가 [[문서 형식 정의|Document Type Definition]] (DTD)에 대한 참조를 포함하고, 문서의 엘리먼트들과 애트리뷰트들이 그 DTD에 선언되어 있으며 DTD가 명시하는 문법 규칙을 따른다는 것을 의미한다.
 
XML 프로세서는 ''유효화하는validating'' 또는 ''유효화하지 않는non-validating''으로, 유효성 검증 여부에 따라 분류한다. 유효성 오류를 조사하는 프로세서는 그것을 보고할 수 있어야 하지만, 정상 처리를 계속할 수도 있다.
XML processors are classified as ''validating'' or ''non-validating'' depending on whether or not they check XML documents for validity. A processor that discovers a validity error must be able to report it, but may continue normal processing.
 
DTD는 ''[[XML schema|schema]]'' 또는 ''문법''의 예이다. XML 1.0의 초판 발표 이래로, XML을 위한 스키마 언어 분야의 연구가 많이 이루어졌다. 그런 스키마 언어들은 전형적으로 어떤 문서에서 사용되어도 좋은 엘리먼트의 종류, 그 엘리먼트들에 적용되어도 좋은 애트리뷰트의 종류, 나타나는 순서, 허용 가능한 부모-자식 관계 등을 제한한다.
A DTD is an example of a ''[[XML schema|schema]]'' or ''grammar''. Since the initial publication of XML 1.0, there has been substantial work in the area of schema languages for XML. Such schema languages typically constrain the set of elements that may be used in a document, which attributes may be applied to them, the order in which they may appear, and the allowable parent/child relationships.
 
===Document Type Definition===
{{Main|Document Type Definition}}
The oldest schema language for XML is the [[Document Type Definition]] (DTD), inherited from [[SGML]].
 
DTDs have the following benefits:
* DTD support is ubiquitous due to its inclusion in the XML 1.0 standard.
* DTDs are terse compared to element-based schema languages and consequently present more information in a single screen.
* DTDs allow the declaration of [[SGML entity|standard public entity sets]] for publishing characters.
* DTDs define a ''document type'' rather than the types used by a namespace, thus grouping all constraints for a document in a single collection.
 
DTDs have the following limitations:
* They have no explicit support for newer [[feature (software design)|feature]]s of XML, most importantly [[XML Namespace|namespaces]].
* They lack expressiveness. XML DTDs are simpler than SGML DTDs and there are certain structures that cannot be expressed with regular grammars. DTDs only support rudimentary datatypes.
* They lack readability. DTD designers typically make heavy use of parameter entities (which behave essentially as textual [[macro (computer science)|macros]]), which make it easier to define complex grammars, but at the expense of clarity.
* They use a syntax based on [[regular expression]] syntax, inherited from [[SGML]], to describe the schema. Typical XML APIs such as [[Simple API for XML|SAX]] do not attempt to offer applications a structured representation of the syntax, so it is less accessible to programmers than an element-based syntax may be.
 
Two peculiar features that distinguish DTDs from other schema types are the syntactic support for embedding a DTD within XML documents and for defining ''entities'', which are arbitrary fragments of text and/or markup that the XML processor inserts in the DTD itself and in the XML document wherever they are referenced, like character escapes.
 
DTD technology is still used in many applications because of its ubiquity.
 
== 같이 보기 ==
익명 사용자