E D R , A S I H C RSS

Document Object Model

{{| |}}

1. DOM

DOM_Inspector.png

{{|
Document Object Model (DOM) is an application programming interface to access HTML and XML documents. It is programming language and platform independent. Behind the interface the document is represented with an object-oriented model.

Different variants of DOMs were initially implemented by web browsers to manipulate elements in an HTML document. This prompted the World Wide Web Consortium (W3C) to come up with a series of standard specifications for DOM (hence called W3CDOM).

DOM puts no restrictions on the document's underlying data structure. A well-structured document can take the tree form using DOM.

Most XML parsers (e.g., Xerces) and XSL processors (e.g., Xalan) have been developed to make use of the tree structure. Such an implementation requires that the entire content of a document be parsed and stored in memory. Hence, DOM is best used for applications where the document elements have to be randomly accessed and manipulated. For XML-based applications which involve a one-time selective read/write per parse, DOM presents a considerable overhead on memory. The SAX model is advantageous in such a case in terms of speed and memory consumption.
|}}

DOM은 HTML, XML문서를 다루는 API이다. 이것은 프로그래밍 언어와 플랫폼에 비종속적이다. 인터페이스의 뒷쪽에서 이 문서는 객체지향 모델로 다루어진다.
초기에는 웹 브라우저가 HTML의 요소를 다루기위해서 각기 다른 형태의 DOM을 만들었다. 이러던 것이 W3C가 DOM에 대한 표준(W3CDOM)를 지정하게되었다.
DOM은 그 문서의 하부의 데이터 구조에는 어떠한 제약사항도 두질 않는다. 잘 만들어진 문서는 DOM을 이용해서 트리 구조를 취할 수 있다.
대부분의 XML파서들 그리고 XSL 처리기들은 트리구조를 사용할 수 있도록 개발되었다. 그러한 구현물들은 메모리 안에서 문서의 전체 내용이 파싱되고 저장되는 것이 필요했다. 따라서 DOM은 임의로 접근하고 다루어 질 수 있는 document 요소를 가지는 응용프로그래에서 사용하기좋다. XML기반의 응용프로그램들이 한번 파싱을 할때 읽거나, 쓸수 밖에 없기 때문에 DOM은 메모리 상에서 상당한 오버헤드적 요소를 가지고 있다. SAX 모델은 속도, 메모리의 비효율성 면에 있어서 이점을 가진 모델이다.

2. 바깥고리

3. Thread

요즘 XML에 대해서 보고 있는데... 하도 DOM, DOM하길래.. ㅡ.ㅡ 먼가했더니 생각보다 엄청난 개념은 아니네요. - eternalbleu

XML 에 대해서 파싱하는 API 방식 이야기. DOM 모델이냐 SAX 모델이냐 하는것. 인터페이스 상으로는 DOM 이 쉽긴 함. SAX 는 좀 더 low-level 하다고 할까. (SAX 파서를 이용해서 DOM 모델을 만들어내는 경우가 많음) SAX 는 Tokenizer 가 해당 XML 문서를 분석하는 중의 이벤트에 대한 이벤트 핸들링 코드를 작성하는 것이므로. 그대신 모든 도큐먼트 노드 데이터가 필요한건 아니니, SAX API 로 XML을 파싱하면서 직접 개발자가 쓸 DOM 객체를 구성하거나, 아니면 XPath 를 이용하는게 좋겠지.

DOM API 쓰는 코드와 SAX API 쓰는 코드는 XML에서 한글 처리하기 페이지중 소스코드를 참조. XPathPyKug:HowToUseXPath를 참조. --1002
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:09
Processing time 0.0187 sec