Hướng dẫn XML

TRANG CHỦ XML Giới thiệu XML Cách sử dụng XML Cây XML Cú pháp XML Phần tử XML Thuộc tính XML Không gian tên XML Hiển thị XML HttpRequest XML Trình phân tích cú pháp XML DOM XML XPath XML XSLT XML XQuery XML XML XLink Trình xác thực XML DTD XML Lược đồ XML Máy chủ XML Ví dụ về XML Câu đố XML Chứng chỉ XML

XML AJAX

Giới thiệu AJAX AJAX XMLHttp Yêu cầu AJAX Phản hồi AJAX Tệp XML AJAX AJAX PHP AJAX ASP Cơ sở dữ liệu AJAX Ứng dụng AJAX Ví dụ về AJAX

DOM XML

Giới thiệu DOM Nút DOM Truy cập DOM Thông tin nút DOM Danh sách nút DOM DOM Traversing Điều hướng DOM DOM Nhận giá trị Nút thay đổi DOM DOM Xóa các nút Nút thay thế DOM DOM Tạo nút DOM Thêm nút Nút nhân bản DOM Ví dụ về DOM

Hướng dẫn XPath

Giới thiệu XPath Nút XPath Cú pháp XPath Trục XPath Toán tử XPath Ví dụ về XPath

Hướng dẫn XSLT

Giới thiệu XSLT Ngôn ngữ XSL Chuyển đổi XSLT XSLT <template> XSLT <value-of> XSLT <for-each> XSLT <sắp xếp> XSLT <if> XSLT <chọn> Áp dụng XSLT XSLT trên máy khách XSLT trên Máy chủ XSLT Chỉnh sửa XML Ví dụ về XSLT

Hướng dẫn XQuery

Giới thiệu XQuery Ví dụ về XQuery XQuery FLWOR HTML XQuery Điều khoản XQuery Cú pháp XQuery XQuery Thêm Chọn XQuery Hàm XQuery

DTD XML

Giới thiệu DTD Khối xây dựng DTD Phần tử DTD Các thuộc tính DTD Phần tử DTD so với Attr Thực thể DTD Ví dụ về DTD

Lược đồ XSD

Giới thiệu XSD XSD Cách thực hiện XSD <schema> Phần tử XSD Thuộc tính XSD Hạn chế XSD

XSD Complex

Phần tử XSD XSD trống Chỉ các phần tử XSD Chỉ văn bản XSD XSD hỗn hợp Chỉ báo XSD XSD <nhiều> XSD <anyAttribute> Thay thế XSD Ví dụ về XSD

Dữ liệu XSD

Chuỗi XSD Ngày XSD XSD Numeric XSD Misc Tham chiếu XSD

Dịch vụ web

Dịch vụ XML WSDL XML SOAP XML RDF XML RSS XML

Người giới thiệu

Các loại nút DOM Nút DOM DOM NodeList DOM NamedNodeMap Tài liệu DOM Phần tử DOM Thuộc tính DOM Văn bản DOM DOM CDATA Bình luận DOM DOM XMLHttpRequest Trình phân tích cú pháp DOM Phần tử XSLT Hàm XSLT / XPath

DOM XML - Đối tượng Tài liệu


Đối tượng Tài liệu đại diện cho toàn bộ tài liệu XML.


Đối tượng tài liệu XML

Đối tượng Document là gốc của cây tài liệu XML và cung cấp cho chúng tôi quyền truy cập chính vào dữ liệu của tài liệu.

Vì các nút phần tử, nút văn bản, chú thích, hướng dẫn xử lý, v.v. không thể tồn tại bên ngoài tài liệu, nên đối tượng Tài liệu cũng chứa các phương thức để tạo các đối tượng này. Các đối tượng Node có thuộc tính ownerDocument liên kết chúng với Tài liệu nơi chúng được tạo.

Thuộc tính đối tượng tài liệu

Property Description
childNodes Returns a NodeList of child nodes for the document
doctype Returns the Document Type Declaration associated with the document
documentElement Returns the root node of the document
documentURI Sets or returns the location of the document
domConfig Returns the configuration used when normalizeDocument() is invoked
firstChild Returns the first child node of the document
implementation Returns the DOMImplementation object that handles this document
inputEncoding Returns the encoding used for the document (when parsing)
lastChild Returns the last child node of the document
nodeName Returns the name of a node (depending on its type)
nodeType Returns the node type of a node
nodeValue Sets or returns the value of a node (depending on its type)
xmlEncoding Returns the XML encoding of the document
xmlStandalone Sets or returns whether the document is standalone
xmlVersion Sets or returns the XML version of the document

Phương pháp đối tượng tài liệu

Method Description
adoptNode(sourcenode) Adopts a node from another document to this document, and returns the adopted node
createAttribute(name) Creates an attribute node with the specified name, and returns the new Attr object
createAttributeNS(uri,name) Creates an attribute node with the specified name and namespace, and returns the new Attr object
createCDATASection() Creates a CDATA section node
createComment() Creates a comment node
createDocumentFragment() Creates an empty DocumentFragment object, and returns it
createElement() Creates an element node
createElementNS() Creates an element node with a specified namespace
createEntityReference(name) Creates an EntityReference object, and returns it
createProcessingInstruction(target,data) Creates a ProcessingInstruction object, and returns it
createTextNode() Creates a text node
getElementById(id) Returns the element that has an ID attribute with the given value. If no such element exists, it returns null
getElementsByTagName() Returns a NodeList of all elements with a specified name
getElementsByTagNameNS() Returns a NodeList of all elements with a specified name and namespace
importNode(nodetoimport,deep) Imports a node from another document to this document. This method creates a new copy of the source node. If the deep parameter is set to true, it imports all children of the specified node. If set to false, it imports only the node itself. This method returns the imported node
normalizeDocument()  
renameNode() Renames an element or attribute node


Thuộc tính đối tượng DocumentType

Mỗi tài liệu có một thuộc tính DOCTYPE có giá trị là null hoặc một đối tượng DocumentType.

Đối tượng DocumentType cung cấp một giao diện cho các thực thể được xác định cho một tài liệu XML.

Property Description
name Returns the name of the DTD
publicId Returns the public identifier of the DTD
systemId Returns the system identifier of the external DTD

Phương pháp đối tượng DocumentImplementation

Đối tượng DOMImplementation thực hiện các hoạt động độc lập với bất kỳ trường hợp cụ thể nào của mô hình đối tượng tài liệu.

Method Description
createDocument(nsURI, name, doctype) Creates a new DOM Document object of the specified doctype
createDocumentType(name, pubId, systemId) Creates an empty DocumentType node
getFeature(feature, version) Returns an object which implements the APIs of the specified feature and version, if the is any
hasFeature(feature, version) Checks whether the DOM implementation implements a specific feature and version

Thuộc tính đối tượng xử lý

Đối tượng ProcessingInstruction đại diện cho một lệnh xử lý.

Một hướng dẫn xử lý được sử dụng như một cách để giữ thông tin cụ thể của bộ xử lý trong văn bản của tài liệu XML.

Property Description
data Sets or returns the content of this processing instruction
target Returns the target of this processing instruction