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

Mục lược đồ XML


❮ Tham chiếu lược đồ XML hoàn chỉnh

Định nghĩa và Cách sử dụng

Phần tử lược đồ xác định phần tử gốc của một lược đồ.

Thông tin phần tử

  • Phần tử chính: KHÔNG

Cú pháp

<schema
id=ID
attributeFormDefault=qualified|unqualified
elementFormDefault=qualified|unqualified
blockDefault=(#all|list of (extension|restriction|substitution))
finalDefault=(#all|list of (extension|restriction|list|union))
targetNamespace=anyURI
version=token
xmlns=anyURI
any attributes
>

((include|import|redefine|annotation)*,(((simpleType|complexType|
group|attributeGroup)|element|attribute|notation),annotation*)*)

</schema>

Attribute Description
id Optional. Specifies a unique ID for the element
attributeFormDefault Optional. The form for attributes declared in the target namespace of this schema. The value must be "qualified" or "unqualified". Default is "unqualified". "unqualified" indicates that attributes from the target namespace are not required to be qualified with the namespace prefix. "qualified" indicates that attributes from the target namespace must be qualified with the namespace prefix
elementFormDefault Optional. The form for elements declared in the target namespace of this schema. The value must be "qualified" or "unqualified". Default is "unqualified". "unqualified" indicates that elements from the target namespace are not required to be qualified with the namespace prefix. "qualified" indicates that elements from the target namespace must be qualified with the namespace prefix
blockDefault Optional. Specifies the default value of the block attribute on element and complexType elements in the target namespace. The block attribute prevents a complex type (or element) that has a specified type of derivation from being used in place of this complex type. This value can contain #all or a list that is a subset of extension, restriction, or substitution:
  • extension - prevents complex types derived by extension
  • restriction - prevents complex types derived by restriction
  • substitution - prevents substitution of elements
  • #all - prevents all derived complex types
finalDefault Optional. Specifies the default value of the final attribute on element, simpleType, and complexType elements in the target namespace. The final attribute prevents a specified type of derivation of an element, simpleType, or complexType element. For element and complexType elements, this value can contain #all or a list that is a subset of extension or restriction. For simpleType elements, this value can additionally contain list and union:
  • extension - prevents derivation by extension
  • restriction - prevents derivation by restriction
  • list - prevents derivation by list
  • union - prevents derivation by union
  • #all - prevents all derivation
targetNamespace Optional. A URI reference of the namespace of this schema
version Optional. Specifies the version of the schema
xmlns A URI reference that specifies one or more namespaces for use in this schema. If no prefix is assigned, the schema components of the namespace can be used with unqualified references
any attributes Optional. Specifies any other attributes with non-schema namespace

ví dụ 1

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="values" type="xs:string" />

</xs:schema>

Ví dụ 2

Trong ví dụ này, các thành phần lược đồ (tên phần tử, loại) trong không gian tên http://www.w3.org/2001/XMLSchema là không đủ tiêu chuẩn và các thành phần cho https://www.w3schools.com/w3schoolsschema (mystring) là đủ điều kiện với tiền tố wsc:

<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:wsc="https://www.w3schools.com/w3shoolsschema">

<element name="fname" type="wsc:mystring"/>

</schema>

❮ Tham chiếu lược đồ XML hoàn chỉnh