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 Skema element Element


❮ Voltooi XML-skemaverwysing

Definisie en gebruik

Die element element definieer 'n element.

Elementinligting

  • Ouerelemente: skema, keuse, alles, volgorde, groep

Sintaksis

<element
id=ID
name=NCName
ref=QName
type=QName
substitutionGroup=QName
default=string
fixed=string
form=qualified|unqualified
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
nillable=true|false
abstract=true|false
block=(#all|list of (extension|restriction))
final=(#all|list of (extension|restriction))
any attributes
>

annotation?,(simpleType|complexType)?,(unique|key|keyref)*

</element>

(Die ? teken verklaar dat die element nul of een keer kan voorkom, en die * teken verklaar dat die element nul of meer keer binne die element element kan voorkom)

Attribute Description
id Optional. Specifies a unique ID for the element
name Optional. Specifies a name for the element. This attribute is required if the parent element is the schema element
ref Optional. Refers to the name of another element. The ref attribute can include a namespace prefix. This attribute cannot be used if the parent element is the schema element
type Optional. Specifies either the name of a built-in data type, or the name of a simpleType or complexType element
substitutionGroup Optional. Specifies the name of an element that can be substituted with this element. This attribute cannot be used if the parent element is not the schema element
default Optional. Specifies a default value for the element (can only be used if the element's content is a simple type or text only)
fixed Optional. Specifies a fixed value for the element (can only be used if the element's content is a simple type or text only)
form Optional. Specifies the form for the element. "unqualified" indicates that this element is not required to be qualified with the namespace prefix. "qualified" indicates that this element must be qualified with the namespace prefix. The default value is the value of the elementFormDefault attribute of the schema element. This attribute cannot be used if the parent element is the schema element
maxOccurs Optional. Specifies the maximum number of times this element can occur in the parent element. The value can be any number >= 0, or if you want to set no limit on the maximum number, use the value "unbounded". Default value is 1. This attribute cannot be used if the parent element is the schema element
minOccurs Optional. Specifies the minimum number of times this element can occur in the parent element. The value can be any number >= 0. Default value is 1. This attribute cannot be used if the parent element is the schema element
nillable Optional. Specifies whether an explicit null value can be assigned to the element. True enables an instance of the element to have the null attribute set to true. The null attribute is defined as part of the XML Schema namespace for instances. Default is false
abstract Optional. Specifies whether the element can be used in an instance document. True indicates that the element cannot appear in the instance document. Instead, another element whose substitutionGroup attribute contains the qualified name (QName) of this element must appear in this element's place. Default is false
block Optional. Prevents an element with a specified type of derivation from being used in place of this element. This value can contain #all or a list that is a subset of extension, restriction, or equivClass:
  • extension - prevents elements derived by extension
  • restriction - prevents elements derived by restriction
  • substitution - prevents elements derived by substitution
  • #all - prevents all derived elements
final Optional. Sets the default value of the final attribute on the element element.  This attribute cannot be used if the parent element is not the schema element. This value can contain #all or a list that is a subset of extension or restriction:
  • extension - prevents elements derived by extension
  • restriction - prevents elements derived by restriction
  • #all - prevents all derived elements
any attributes Optional. Specifies any other attributes with non-schema namespace

Voorbeeld 1

Die volgende voorbeeld is 'n skema met vier eenvoudige elemente genaamd "fname", "lname", "age" en "dateborn", wat van die tipe string, nonNegativeInteger en date is:

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

<xs:element name="fname" type="xs:string"/>
<xs:element name="lname" type="xs:string"/>
<xs:element name="age" type="xs:nonNegativeInteger"/>
<xs:element name="dateborn" type="xs:date"/>

</xs:schema>

Voorbeeld 2

Die volgende voorbeeld is 'n skema met 'n element genaamd "noot" wat van 'n komplekse tipe is. Die "noot"-element bevat vier ander eenvoudige elemente; "na", "van", "opskrif" en "liggaam":

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

<xs:element name="note">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="to" type="xs:string"/>
      <xs:element name="from" type="xs:string"/>
      <xs:element name="heading" type="xs:string"/>
      <xs:element name="body" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

</xs:schema>

Voorbeeld 3

Hierdie voorbeeld is redelik gelyk aan Voorbeeld 2, maar hier het ons gekies om die ref-kenmerk te gebruik om na die elementname te verwys:

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

<xs:element name="note">
  <xs:complexType>
    <xs:sequence>
      <xs:element ref="to"/>
      <xs:element ref="from"/>
      <xs:element ref="heading"/>
      <xs:element ref="body"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>

</xs:schema>

❮ Voltooi XML-skemaverwysing