Tutoriel XML

ACCUEIL XML Introduction XML XML Comment utiliser Arbre XML Syntaxe XML Éléments XML Attributs XML Espaces de noms XML Affichage XML Requête HTTP XML Analyseur XML DOM XML XPath XML XML XSLT XQuery XML XMLXLink Validateur XML DTD XML Schéma XML Serveur XML Exemples XML XML Quiz Certificat XML

XMLAJAX

Présentation d'AJAX AJAX XMLHttp Requête AJAX Réponse AJAX Fichier XML AJAX PHP AJAX ASP AJAX Base de données AJAX Applications AJAX Exemples AJAX

DOM XML

Présentation du DOM Nœuds DOM Accès au DOM Informations sur le nœud DOM Liste des nœuds DOM Traversée du DOM Navigation DOM DOM Obtenir des valeurs Nœuds de changement DOM DOM Supprimer les nœuds DOM Remplacer les nœuds DOM Créer des nœuds DOM Ajouter des nœuds Nœuds de clonage DOM Exemples DOM

Tutoriel XPath

Présentation de XPath Nœuds XPath Syntaxe XPath Axes XPath Opérateurs XPath Exemples XPath

Tutoriel XSLT

Présentation de XSLT Langages XSL Transformation XSLT XSLT <modèle> XSLT <valeur-de> XSLT <pour-chaque> XSLT <sort> XSLT <si> XSLT <choisir> Appliquer XSLT XSLT sur le client XSLT sur le serveur XSLT Éditer XML Exemples XSLT

Tutoriel XQuery

Présentation de XQuery Exemple XQuery XQuery FLWOR XQuery HTML Termes XQuery Syntaxe XQuery Ajouter XQuery Sélection XQuery Fonctions XQuery

DTD XML

Présentation de la DTD Blocs de construction DTD Éléments DTD Attributs DTD Éléments DTD vs Attr Entités DTD Exemples de DTD

Schéma XSD

Présentation XSD Comment XSD XSD <schéma> Éléments XSD Attributs XSD Restrictions XSD

Complexe XSD

Éléments XSD XSD vide Éléments XSD uniquement Texte XSD uniquement XSD Mixte Indicateurs XSD XSD <tout> XSD <anyAttribute> Remplacement XSD Exemple XSD

Données XSD

Chaîne XSD Date XSD Numérique XSD Divers XSD Référence XSD

Services Web

Services XML XMLWSDL SAVON XML XML RDF XML RSS

Les références

Types de nœuds DOM Nœud DOM Liste de nœuds DOM DOM NamedNodeMap Documents DOM Élément DOM Attribut DOM Texte DOM DOM CDATA DOM Comment DOM XMLHttpRequest Analyseur DOM Éléments XSLT Fonctions XSLT/XPath

XML DOM - L' objet nœud


L'objet nœud

L'objet Node représente un nœud unique dans l'arborescence du document.

Un nœud peut être un nœud d'élément, un nœud d'attribut, un nœud de texte ou tout autre type de nœud expliqué dans le chapitre Types de nœuds .

Notez que bien que tous les objets héritent des propriétés/méthodes Node pour traiter les parents et les enfants, tous les objets ne peuvent pas avoir de parents ou d'enfants. Par exemple, les nœuds de texte peuvent ne pas avoir d'enfants, et l'ajout d'enfants à ces nœuds entraîne une erreur DOM.

Propriétés de l'objet nœud

Property Description
attributes A NamedNodeMap containing the attributes of this node (if it is an Element)
baseURI Returns the absolute base URI of a node
childNodes Returns a NodeList of child nodes for a node
firstChild Returns the first child of a node
lastChild Returns the last child of a node
nextSibling Returns the node immediately following a node
nodeName Returns the name of a node, depending on its type
nodeType Returns the type of a node
nodeValue Sets or returns the value of a node, depending on its type
ownerDocument Returns the root element (document object) for a node
parentNode Returns the parent node of a node
prefix Sets or returns the namespace prefix of a node
previousSibling Returns the node immediately before a node
textContent Sets or returns the textual content of a node and its descendants


Méthodes d'objet de nœud

Method Description
appendChild() Appends a new child node to the end of the list of children of a node
cloneNode() Clones a node
compareDocumentPosition() Compares the placement of two nodes in the DOM hierarchy (document)
getFeature(feature,version) Returns a DOM object which implements the specialized APIs of the specified feature and version
getUserData(key) Returns the object associated to a key on a this node. The object must first have been set to this node by calling setUserData with the same key
hasAttributes() Returns true if the specified node has any attributes, otherwise false
hasChildNodes() Returns true if the specified node has any child nodes, otherwise false
insertBefore() Inserts a new child node before an existing child node
isDefaultNamespace(URI) Returns whether the specified namespaceURI is the default
isEqualNode() Tests whether two nodes are equal
isSameNode() Tests whether the two nodes are the same node
lookupNamespaceURI() Returns the namespace URI associated with a given prefix
lookupPrefix() Returns the prefix associated with a given namespace URI
normalize() Puts all Text nodes underneath a node (including attribute nodes) into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes
removeChild() Removes a specified child node from the current node
replaceChild() Replaces a child node with a new node
setUserData(key,data,handler) Associates an object to a key on a node