Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

XML schema element


May 28, 2021 XML Schema


Table of contents


XML Schema element

This section describes the definition of schema elements and their related use.


XML schema element Complete XML Schema reference manual

Definitions and usages

The schema element defines the root element of schema.

Element information

  • Parent element: (no parent element)

Grammar

<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>

Attributes describe
id Optional.Specifies the only ID of the element.
attributeFormDefault

Optional.In the form of attributes declared in the target namespace of the Schema.This value must be one of the following strings: "Qualified" or "UNQUALIFIED".The default is "unqualified".

  • "UNQUALIFIED" indicates whether the property namespace is defined by the namespace prefix.
  • "Qualified" indicates that the properties of the target namespace must be qualified by the namespace prefix.
elementFormDefault

Optional.In the form of an element declared in the target namespace of the Schema.This value must be one of the following strings: "Qualified" or "UNQUALIFIED".The default is "unqualified".

  • "UNQUALIFIED" indicates that you do not need to limit the element of the target namespace by the namespace prefix.
  • "Qualified" indicates that the elements of the target namespace must be defined by the namespace prefix.
blockDefault

Optional.The default values for the Block property on the Element and ComplexType elements are specified in the target namespace.Block attributes prevent complex types (or elements) with specified derived types (or elements) that are used instead of complex types (or elements).This value can contain #all or a list, which is an extension, restriction, or subsset:

  • Extension - Prevents complex types from being expanded to replace the complex type.
  • RESTRICTION - Prevents the complex type by restriction derivation, is used to replace the complex type.
  • Substitution - Preventing the replacement of elements.
  • #all - Prevent all derived complex types from being used instead of the complex type.
finalDefault

Optional.The default value of the final property of Element, SimpleType, and ComplexType elements is specified in the target namespace of this architecture.Final property prevents the specified derived type of Element, SimpleType or ComplexType element.For Element and ComplexType elements, this value can contain #all or a list, which is the subset of Extension or Restriction.For SimpleType elements, this value can also contain List and Union:

  • Extension - By default, the elements in the schema cannot be derived by expanding.Only for Element and ComplexType elements.
  • Restriction - Prevents derivation by limiting.
  • List - prevents derived by listing.Applies only to the SimpleType element.
  • A Prevent Boys from being born.Applies only to the SimpleType element.
  • #all - By default, the elements in this schema cannot be derived by any method.
targetNamespace

The URI reference of the Schema's namespace.You can also assign the prefix of the namespace.If no prefix is assigned, the Schema component of the namespace can be used with unlimited references.

version

Optional.Specifies the version of Schema.

xmlns

The URI references for one or more namespaces used in this Schema are specified.If there is no prefix, the Schema component of the namespace can be used with unlimited references.

any attributes

Optional.Specifies any other attribute with the Non-Schema namespace.

Instance 1

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

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

</xs:schema>

Example 2

In this case, http://www.w3.org/2001/XMLSchema the schema component (element name, type) in the namespace is not restricted, while //www.w3cschool.cn/w3cschoolschema (mystring) is limited by the wsc prefix:

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

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

</schema>


XML schema element Complete XML Schema reference manual