11.07.2015 Views

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Dreyfus, Hubert 161gle computer) to a more comprehensive “network objectmodel.”Document <strong>and</strong> object models are also increasinglyimportant for working on the Web. This can be seen inthe increasing use <strong>of</strong> XML documents <strong>and</strong> the DocumentObject Model (see xml <strong>and</strong> dom). This involves the use <strong>of</strong> aconsistent programming interface (see api) by which manyapplications can create or process XML documents for datacommunication or display.Further ReadingBornestein, Niel M. .NET <strong>and</strong> XML. Sebastapol, Calif.: O’ReillyMedia, 2003.“Document Object Model (DOM).” World Wide Web Consortium.Available online. URL: http://www.w3.org/DOM/. AccessedAugust 12, 2007.Lowry, Juval. Programming .NET Components. 2nd ed. Sebastapol,Calif.: O’Reilly Media, 2005.“Open Document Format for Office Applications: OASIS St<strong>and</strong>ard.”Available online. URL: http://docs.oasis-open.org/<strong>of</strong>fice/v1.0. Accessed July 10, 2007.DOM (Document Object Model)The Document Object Model (DOM) is a way to representa Web document (see html <strong>and</strong> xml) as an object thatcan be manipulated using code in a scripting language (seeJavaScript). The DOM was created by the World Wide WebConsortium (W3C) as a way to st<strong>and</strong>ardize methods <strong>of</strong>manipulating Web pages at a time when different browsersused different access models. The full specification isdivided into four levels (0 through 3). By 2005, most DOMspecifications were supported by the major Web browsers.Using DOM, a programmer can navigate through thehierarchical structure <strong>of</strong> a document, following links or“descending” into forms <strong>and</strong> user-interface objects. WithDOM one can also add HTML or XML elements, as well asload, save, or format documents.Code can also be written to respond to a number <strong>of</strong>“events,” including user keyboard or mouse activity <strong>and</strong>interactions with specific user-interface elements <strong>and</strong>HTML forms. For example, the “mouseover” event will betriggered when the user moves the mouse cursor over adefined region. The code can then perform an action suchas popping up a box with explanatory text. The “submit”event will be triggered when the user has finished fillingin a form <strong>and</strong> clicked the button to send it to the Website. When an event occurs, the event object is used topass detailed information about it to the program, such aswhich key or button was pressed, the location <strong>of</strong> the mousepointer, <strong>and</strong> so on.Although learning the DOM methods <strong>and</strong> how to usethem takes some time, <strong>and</strong> familiarity with JavaScript ishelpful, the syntax for accessing DOM methods should befamiliar to anyone who has used an object-oriented programminglanguage. Here are some simple sample statements.Get the document with the specified ID:document.getElementById(ID)Get the element with the specified tag:document.getElementByTagName(tagname)Get the specified attribute (property) <strong>of</strong>the specified element:myElement.getAttribute(attributeName)Create an element with the specified tag <strong>and</strong>reference it through a variable:var myElementNode = document.createElement(tagname)EvaluationAlthough dynamic HTML (DHTML) also has an objectmodel that can be used to access <strong>and</strong> manipulate individualelements, DOM is more comprehensive because it providesaccess to the document as a whole <strong>and</strong> the ability to navigatethrough its structure.By providing a uniform way to manipulate documents,DOM makes it easier to write tools to process them in aseries <strong>of</strong> steps. For example, database programs <strong>and</strong> XMLparsers can produce DOM document “trees” as output, <strong>and</strong>an XSLT (XML style sheet processor) can then be used t<strong>of</strong>ormat the final output.For working with XML, another popular alternative isthe Simple API for XML (SAX). The SAX model is quite differentfrom DOM in that the former “sees” a document asa stream <strong>of</strong> events (such as element nodes) <strong>and</strong> the parseris programmed to call methods as events are encountered.DOM, on the other h<strong>and</strong>, is not a stream but a tree that canbe entered arbitrarily <strong>and</strong> traversed in any direction. Onthe other h<strong>and</strong>, SAX streams do not require that the entiredocument be held in memory, <strong>and</strong> processing can sometimesbe faster.Further ReadingDocument Object Model FAQ. World Wide Web Consortium.Available online. URL: http://www.w3.org/DOM/faq.html.Accessed September 16, 2007.Heilmann, Christian. Beginning JavaScript with DOM Scripting <strong>and</strong>Ajax: From Novice to Pr<strong>of</strong>essional. Berkeley, Calif.: APress, 2006.Keith, Jeremy. DOM Scripting: Web Design with JavaScript <strong>and</strong> theDocument Object Model. Berkeley, Calif.: APress, 2005.Robie, Jonathan. “What Is the Document Object Model?” WorldWide Web Consortium. Available online. URL: http://www.w3.org/TR/WD-DOM/introduction.html. Accessed September14, 2007.Sambells, Jeffrey, <strong>and</strong> Aaron Gustafson. Advanced DOM Scripting:Dynamic Web Design Techniques. Berkeley, Calif.: APress,2007.DOS See ms-dos.Dreyfus, Hubert(1929– )AmericanPhilosopher, Cognitive PsychologistAs the possibilities for computers going beyond “numbercrunching” to sophisticated information processing becameclear starting in the 1950s, the quest to achieve artificial intelligence(AI) was eagerly embraced by a number <strong>of</strong> innovative

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!