Samouczek XML

Strona główna XML Wprowadzenie do XML XML Jak używać Drzewo XML Składnia XML Elementy XML Atrybuty XML Przestrzenie nazw XML Wyświetlacz XML Żądanie HTTP XML Parser XML XML DOM XML XPath XML XSLT XML XQuery XML XLink Walidator XML XML DTD Schemat XML Serwer XML Przykłady XML Quiz XML Certyfikat XML

XML AJAX

Wprowadzenie do AJAX AJAX XMLHttp Żądanie AJAX Odpowiedź AJAX Plik XML AJAX AJAX PHP ASP AJAX Baza danych AJAX Aplikacje AJAX Przykłady AJAX

XML DOM

Wprowadzenie do DOM Węzły DOM Dostęp do DOM Informacje o węźle DOM Lista węzłów DOM Przechodzenie DOM Nawigacja DOM DOM Uzyskaj wartości Zmiana węzłów DOM DOM Usuń węzły DOM Zamień węzły DOM Utwórz węzły DOM Dodaj węzły Węzły klonowania DOM Przykłady DOM

Samouczek XPath

Wprowadzenie do XPath Węzły XPath Składnia XPath Osie XPath Operatorzy XPath Przykłady XPath

Samouczek XSLT

Wprowadzenie XSLT Języki XSL Transformacja XSLT XSLT <szablon> XSLT <wartość-z> XSLT <dla każdego> XSLT <sortuj> XSLT <jeśli> XSLT <wybierz> XSLT Zastosuj XSLT na kliencie XSLT na serwerze XSLT Edytuj XML Przykłady XSLT

Samouczek XQuery

Wprowadzenie do XQuery Przykład XQuery XQuery FLWOR XQuery HTML Warunki XQuery Składnia XQuery XQuery Dodaj XQuery Wybierz Funkcje XQuery

XML DTD

Wprowadzenie do DTD Bloki konstrukcyjne DTD Elementy DTD Atrybuty DTD Elementy DTD a Attr Jednostki DTD Przykłady DTD

Schemat XSD

Wprowadzenie do XSD XSD Jak to zrobić XSD <schemat> Elementy XSD Atrybuty XSD Ograniczenia XSD

Kompleks XSD

Elementy XSD XSD Pusty Tylko elementy XSD Tylko tekst XSD Mieszane XSD Wskaźniki XSD XSD <dowolny> XSD <dowolnyAtrybut> Zastąpienie XSD Przykład XSD

Dane XSD

XSD ciąg Data XSD Numeryczne XSD Różne XSD Odniesienie XSD

Usługi internetowe

Usługi XML XML WSDL MYDŁO XML XML RDF XML RSS

Bibliografia

Typy węzłów DOM Węzeł DOM Lista węzłów DOM DOM NamedNodeMap Dokument DOM Element DOM Atrybut DOM Tekst DOM DOM CDATA Komentarz DOM DOM XMLHttpRequest Analizator DOM Elementy XSLT Funkcje XSLT/XPath

Typy węzłów XML DOM


DOM przedstawia dokument jako hierarchię obiektów węzłów.


Spróbuj sam - przykłady

Poniższe przykłady wykorzystują plik XML books.xml .

×

nagłówek


Typy węzłów

W poniższej tabeli wymieniono różne typy węzłów W3C oraz typy węzłów, które mogą mieć jako dzieci:

Node Type Description Children
Document Represents the entire document (the root-node of the DOM tree) Element (max. one), ProcessingInstruction, Comment, DocumentType
DocumentFragment Represents a "lightweight" Document object, which can hold a portion of a document Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
DocumentType Provides an interface to the entities defined for the document None
ProcessingInstruction Represents a processing instruction None
EntityReference Represents an entity reference Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
Element Represents an element Element, Text, Comment, ProcessingInstruction, CDATASection, EntityReference
Attr Represents an attribute Text, EntityReference
Text Represents textual content in an element or attribute None
CDATASection Represents a CDATA section in a document (text that will NOT be parsed by a parser) None
Comment Represents a comment None
Entity Represents an entity Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
Notation Represents a notation declared in the DTD None


Typy węzłów — zwracane wartości

W poniższej tabeli wymieniono, co właściwości nodeName i nodeValue zwrócą dla każdego typu węzła:

Node Type nodeName returns nodeValue returns
Document #document null
DocumentFragment #document fragment null
DocumentType doctype name null
EntityReference entity reference name null
Element element name null
Attr attribute name attribute value
ProcessingInstruction target content of node
Comment #comment comment text
Text #text content of node
CDATASection #cdata-section content of node
Entity entity name null
Notation notation name null

NodeTypes — nazwane stałe

NodeType Named Constant
1 ELEMENT_NODE
2 ATTRIBUTE_NODE
3 TEXT_NODE
4 CDATA_SECTION_NODE
5 ENTITY_REFERENCE_NODE
6 ENTITY_NODE
7 PROCESSING_INSTRUCTION_NODE
8 COMMENT_NODE
9 DOCUMENT_NODE
10 DOCUMENT_TYPE_NODE
11 DOCUMENT_FRAGMENT_NODE
12 NOTATION_NODE