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μ—μ„œ ν•œκΈ€ μ²˜λ¦¬ν•˜κΈ° νŽ˜μ΄μ§€μ€‘ μ†ŒμŠ€μ½”λ“œλΌ μ°Έμ‘°. XPath λŠ” PyKug:HowToUseXPathλΌ μ°Έμ‘°. --1002
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:09
Processing time 0.0262 sec