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


❮ Voltooi XML-skemaverwysing

Definisie en gebruik

Die kenmerkelement definieer 'n kenmerk.

Elementinligting

  • Ouer-elemente: kenmerkGroep, skema, kompleksTipe, beperking (beide eenvoudigeInhoud en komplekseInhoud), uitbreiding (beide eenvoudigInhoud en komplekseInhoud)

Sintaksis

<attribute
default=string
fixed=string
form=qualified|unqualified
id=ID
name=NCName
ref=QName
type=QName
use=optional|prohibited|required
any attributes
>

(annotation?,(simpleType?))

</attribute>

(Die ? teken verklaar dat die element nul of een keer binne die kenmerkelement kan voorkom)

Attribute Description
default Optional. Specifies a default value for the attribute. Default and fixed attributes cannot both be present
fixed Optional. Specifies a fixed value for the attribute. Default and fixed attributes cannot both be present
form Optional. Specifies the form for the attribute. The default value is the value of the attributeFormDefault attribute of the element containing the attribute. Can be set to one of the following:
  • "qualified" - indicates that this attribute must be qualified with the namespace prefix and the no-colon-name (NCName) of the attribute
  • unqualified - indicates that this attribute is not required to be qualified with the namespace prefix and is matched against the (NCName) of the attribute
id Optional. Specifies a unique ID for the element
name Optional. Specifies the name of the attribute. Name and ref attributes cannot both be present
ref Optional. Specifies a reference to a named attribute. Name and ref attributes cannot both be present. If ref is present, simpleType element, form, and type cannot be present
type Optional. Specifies a built-in data type or a simple type. The type attribute can only be present when the content does not contain a simpleType element
use Optional. Specifies how the attribute is used. Can be one of the following values:
  • optional - the attribute is optional (this is default)
  • prohibited - the attribute cannot be used
  • required - the attribute is required
any attributes Optional. Specifies any other attributes with non-schema namespace

Voorbeeld 1

<xs:attribute name="code">

<xs:simpleType>
  <xs:restriction base="xs:string">
    <xs:pattern value="[A-Z][A-Z]"/>
  </xs:restriction>
</xs:simpleType>

</xs:attribute>

Die voorbeeld hierbo dui aan dat die "code"-kenmerk 'n beperking het. Die enigste aanvaarbare waarde is twee van die hoofletters van a tot z.

Voorbeeld 2

Om 'n kenmerk te verklaar deur 'n bestaande kenmerkdefinisie binne 'n komplekse tipe te gebruik, gebruik die ref-kenmerk:

<xs:attribute name="code">
  <xs:simpleType>
    <xs:restriction base="xs:string">
      <xs:pattern value="[A-Z][A-Z]"/>
    </xs:restriction>
  </xs:simpleType>
</xs:attribute>

<xs:complexType name="someComplexType">
  <xs:attribute ref="code"/>
</xs:complexType>

Voorbeeld 3

Eienskappe kan óf 'n verstekwaarde OF 'n vaste waarde gespesifiseer hê. 'n Standaardwaarde word outomaties aan die kenmerk toegeken wanneer geen ander waarde gespesifiseer word nie. In die volgende voorbeeld is die verstekwaarde "EN":

<xs:attribute name="lang" type="xs:string" default="EN"/>

'n Vaste waarde word ook outomaties aan die kenmerk toegeken wanneer geen ander waarde gespesifiseer word nie. Maar anders as verstekwaardes; as jy 'n ander waarde as die vaste spesifiseer, word die dokument as ongeldig beskou. In die volgende voorbeeld is die vaste waarde "EN":

<xs:attribute name="lang" type="xs:string" fixed="EN"/>

Voorbeeld 4

Alle eienskappe is by verstek opsioneel. Om uitdruklik te spesifiseer dat die kenmerk opsioneel is, gebruik die "use"-kenmerk:

<xs:attribute name="lang" type="xs:string" use="optional"/>

Om 'n kenmerk vereis te maak:

<xs:attribute name="lang" type="xs:string" use="required"/>

❮ Voltooi XML-skemaverwysing