UP PREVIOUS NEXT   Technologies Internet et Education, © TECFA
  4. Le Document Objet Model (DOM)

4. Le Document Objet Model (DOM)

 

De l'abstract de la spécification (http://www.w3.org/TR/REC-DOM-Level-1/): a platform- and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure and style of documents. The Document Object Model provides a standard set of objects for representing HTML and XML documents, a standard model of how these objects can be combined, and a standard interface for accessing and manipulating them. Vendors can support the DOM as an interface to their proprietary data structures and APIs, and content authors can write to the standard DOM interfaces rather than product-specific APIs, thus increasing interoperability on the Web.

4.1 Le principe du DOM avec un exemple

Exemple 4-1: Un simple table HTML comme "DOM tree"

Les données XML:
<TABLE>  <TBODY>
<TR> <TD>Pierre Muller</TD> 
      <TD>http://pm.com/</TD> </TR>
<TR> <TD>Elisabeth Dupont</TD> 
      <TD></TD> </TR> 
</TBODY> </TABLE>
Rendering typique dans un browser:

 

Pierre Muller

http://pm.com/

Elisabeth Dupont

 

Représentation alternative dans un browser ou un applet:
  • line 1:
    • Pierre Muller
    • http://pm.com/
  • line 2:
    • Elisabeth Dupont
Représentation interne de l'arbre dans le DOM

 

  • Imaginez un script qui peut manipuler cette structure au niveau du contenu, de l'affichage et de l'interface utilisateur
    • Javascript et VB dans les browsers WWW standards
    • Java (et autres) dans des "costum" browser (applets par exemple)
  • Shift de paradigme pour les pages Internet:
    Display quasi-statique => Application

UP PREVIOUS NEXT -- TIE