CSC/ECE 517 Fall 2010/ch6 6g SL

From Expertiza_Wiki
Jump to navigation Jump to search

Document Object Model

The Document Object Model is the language independent and platform independent interface which allows to interact with the document. Typically this interaction is with the objects of the HTML, XHTML and XML documents. DOM can change the content, style and structure of such documents. DOM API is provided in different languages to dynamically change XML and HTML documents.[1]

DOM structure

DOM in HTML, XML, Javascript

Models of programming language objects

The term object model can be used in two different contexts. In one sense; it refers to a collection of concepts used to describe the generic characteristics of objects particularly object oriented languages or its specifications. Over here it closely corresponds to the word data model. Examples of this can be Java object model. This contrasts with the object model used to describe collection of object classes used to model a particular system. A common application of this object model can be defined as the Document Object Model

Any object model has three key concepts

  • data structures that can be used to represent the object state
  • ways to associate behaviour with the object state
  • ways for the object methods to access and operate on that state

DOM vs Models of programming language objects

Other Competing Solutions

JDOM is a java representation of an XML document which makes it easy and efficient for reading and making changes to it. It has a straightforward API for Java programmers. It's an alternative to DOM and SAX, although it integrates well with both DOM and SAX. JDOM came into existance because of the following reasons.

  • DOM and SAX were not suffucient
  • SAX had no documentation and it often required building a state machine
  • DOM was defined in IDL, a lower denominator across languages and it felt foreigner to Java Programmers

The Simple API for XML (SAX) is the event-driven, serial-access mechanism that does element-by-element processing. The API for this level reads and writes XML to a data repository or the web. SAX allows you to process a document as it's being read, which avoids the need to wait for all of it to be stored before taking action.

DOM vs SAX, JAXB, JDOM

Conclusion

References

  1. Document Object Model Introduction.