L'interface DOM
Fondamental :
Document Object Model (DOM) Technical Reports
Document Object Model Core
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html
Objets principaux
Node
: Élément central du DOM, il représente tout nœud de l'arbre DOM, les autres interfaces en héritent.NodeList
: Ensemble ordonné deNode
s.Document
: Racine d'un fichier XML bien formé (ou d'un fichier HTML valide), son fils est donc l'élément racine du document XML.Element
: Représentation d'un élément au sens XMLAttr
: Représentation d'un attribut au sens XMLText
: Contenu textuel d'un nœud texte ou d'un attribut au sens XML
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1590626201
Attributs principaux de Node
string nodeName
integer nodeType
Node parentNode
NodeList childNodes
Node firstChild
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1950641247
Attributs principaux de NodeList
Node item(integer index)
integer length
Fonctions principales de Node
Node insertBefore(Node newChild, Node refChild)
Node replaceChild(Node newChild, Node oldChild)
Node removeChild(Node oldChild)
Node appendChild(Node newChild)
boolean hasChildNodes()
Node cloneNode(boolean deep)
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1950641247
Fonctions principales de Document
Element getElementById(string elementId)
NodeList getElementsByTagName(string tagname)
Element createElement(string tagName)
Text createTextNode(string data)
Attr createAttribute(string name)
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#i-Document
Fonctions principales de Element
NodeList getElementsByTagName(string name)
Attr getAttributeNode(string name)
Attr setAttributeNode(Attr newAttr)
Attr removeAttributeNode(Attr oldAttr)
boolean hasAttribute(string name)
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-745549614
Text (attributs et fonctions)
Attributs :
string data
integer length
Fonctions :
void appendData(string arg)
void insertData(integer offset, string arg)
void deleteData(integer offset, integer count)
void replaceData(integer offset, integer count, string arg)
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1312295772
Attr (attributs)
string name
string value
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-637646024
Remarque : NameSpace
Il existe toutes les fonctions nécessaires pour gérer les namespaces, comme par exemple :
NodeList getElementsByTagNameNS(string namespaceURI, string localName)
Element createElementNS(string namespaceURI, string qualifiedName)
Attr createAttributeNS(string namespaceURI, string qualifiedName)
Complément :
( Brillant07[1], pp238-245)