XML- tutoriaal

XML TUIS XML Inleiding XML Hoe om te gebruik XML-boom XML-sintaksis XML elemente XML-kenmerke XML Naamruimtes XML vertoon XML HttpRequest XML-ontleder XML DOM XML XPath XML XSLT XML XQuery XML XLink XML valideerder XML DTD XML-skema XML-bediener XML voorbeelde XML Vasvra XML-sertifikaat

XML AJAX

AJAX Inleiding AJAX XMLHttp AJAX-versoek AJAX-reaksie AJAX XML-lêer AJAX PHP AJAX ASP AJAX-databasis AJAX toepassings AJAX voorbeelde

XML DOM

DOM Inleiding DOM nodusse Toegang tot DOM DOM Node Info DOM Node Lys DOM deurkruis DOM Navigeer DOM Kry waardes DOM Verander nodusse DOM Verwyder nodes DOM vervang nodusse DOM Skep nodusse DOM Voeg nodes by DOM Kloon nodusse DOM Voorbeelde

XPath handleiding

XPath Inleiding XPath nodes XPath-sintaksis XPath-asse XPath-operateurs XPath voorbeelde

XSLT- tutoriaal

XSLT Inleiding XSL-tale XSLT-transformasie XSLT <sjabloon> XSLT <waarde-van> XSLT <vir-elk> XSLT <sorteer> XSLT <if> XSLT <kies> XSLT Pas toe XSLT op die kliënt XSLT op die bediener XSLT Wysig XML XSLT voorbeelde

XQuery- tutoriaal

XQuery Inleiding XQuery voorbeeld XQuery FLWOR XQuery HTML XQuery-bepalings XQuery-sintaksis XQuery Voeg by XQuery Kies XQuery-funksies

XML DTD

DTD Inleiding DTD Boublokke DTD Elemente DTD-kenmerke DTD Elements vs Attr DTD Entiteite DTD voorbeelde

XSD- skema

XSD Inleiding XSD Hoe om XSD <skema> XSD-elemente XSD-kenmerke XSD-beperkings

XSD -kompleks

XSD-elemente XSD leeg Slegs XSD-elemente Slegs XSD-teks XSD gemeng XSD-aanwysers XSD <enige> XSD <anyAttribute> XSD-vervanging XSD voorbeeld

XSD data

XSD-string XSD datum XSD Numeries XSD Diverse XSD-verwysing

Webdienste _

XML Dienste XML WSDL XML SEEP XML RDF XML RSS

Verwysings

DOM Node Tipes DOM Node DOM NodeLys DOM NamedNodeMap DOM-dokument DOM Element DOM-kenmerk DOM teks DOM CDATA DOM Kommentaar DOM XMLHttpRequest DOM-ontleder XSLT-elemente XSLT/XPath-funksies

XML DOM - Die Element Object


Die Element-voorwerp

Die Element-objek verteenwoordig 'n element in 'n XML-dokument. Elemente kan eienskappe, ander elemente of teks bevat. As 'n element teks bevat, word die teks in 'n teksnodus voorgestel.

BELANGRIK! Teks word altyd in teksnodusse gestoor. 'n Algemene fout in DOM-verwerking is om na 'n elementnodus te navigeer en te verwag dat dit die teks sal bevat. Selfs die eenvoudigste elementnodus het egter 'n teksnodus onder dit. Byvoorbeeld, in <year>2005</year> is daar 'n elementnodus (jaar), en 'n teksnodus daaronder, wat die teks bevat (2005).

Omdat die Element-objek ook 'n Node is, erf dit die Node-objek se eienskappe en metodes.

Element Voorwerp Eienskappe

Property Description
attributes Returns a NamedNodeMap of attributes for the element
baseURI Returns the absolute base URI of the element
childNodes Returns a NodeList of child nodes for the element
firstChild Returns the first child of the element
lastChild Returns the last child of the element
localName Returns the local part of the name of the element
namespaceURI Returns the namespace URI of the element
nextSibling Returns the node immediately following the element
nodeName Returns the name of the node, depending on its type
nodeType Returns the type of the node
ownerDocument Returns the root element (document object) for an element
parentNode Returns the parent node of the element
prefix Sets or returns the namespace prefix of the element
previousSibling Returns the node immediately before the element
schemaTypeInfo Returns the type information associated with the element
tagName Returns the name of the element
textContent Sets or returns the text content of the element and its descendants


Element Object Metodes

Method Description
appendChild() Adds a new child node to the end of the list of children of the node
cloneNode() Clones a node
compareDocumentPosition() Compares the document position of two nodes
getAttribute() Returns the value of an attribute
getAttributeNS() Returns the value of an attribute (with a namespace)
getAttributeNode() Returns an attribute node as an Attribute object
getAttributeNodeNS() Returns an attribute node (with a namespace) as an Attribute object
getElementsByTagName() Returns a NodeList of matching element nodes, and their children
getElementsByTagNameNS() Returns a NodeList of matching element nodes (with a namespace), and their children
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
hasAttribute() Returns whether an element has any attributes matching a specified name
hasAttributeNS() Returns whether an element has any attributes matching a specified name and namespace
hasAttributes() Returns whether the element has any attributes
hasChildNodes() Returns whether the element has any child nodes
insertBefore() Inserts a new child node before an existing child node
isDefaultNamespace(URI) Returns whether the specified namespaceURI is the default
isEqualNode() Checks if two nodes are equal
lookupNamespaceURI() Returns the namespace URI matching a specified prefix
lookupPrefix() Returns the prefix matching a specified namespace URI
normalize() Puts all text nodes underneath this element (including attributes) 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
removeAttribute() Removes a specified attribute
removeAttributeNS() Removes a specified attribute (with a namespace)
removeAttributeNode() Removes a specified attribute node
removeChild() Removes a child node
replaceChild() Replaces a child node
setUserData(key,data,handler) Associates an object to a key on the element
setAttribute() Adds a new attribute
setAttributeNS() Adds a new attribute (with a namespace)
setAttributeNode() Adds a new attribute node
setAttributeNodeNS(attrnode) Adds a new attribute node (with a namespace)
setIdAttribute(name,isId) If the isId property of the Attribute object is true, this method declares the specified attribute to be a user-determined ID attribute
setIdAttributeNS(uri,name,isId) If the isId property of the Attribute object is true, this method declares the specified attribute (with a namespace) to be a user-determined ID attribute
setIdAttributeNode(idAttr,isId) If the isId property of the Attribute object is true, this method declares the specified attribute to be a user-determined ID attribute