0% found this document useful (0 votes)
12 views3 pages

Resum Xmlschemes

This document describes the different elements that can be defined in an XML schema, including: 1) Simple elements with or without attributes 2) Complex elements with child elements and/or attributes 3) Elements with simple content but attributes 4) Elements with simple content and restrictions It also describes how to define attributes without or with restrictions, and how to reuse simple or complex types by assigning them a name and referencing that name. The number of elements can be specified using minOccurs and maxOccurs.

Uploaded by

pakinoww
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Resum Xmlschemes

This document describes the different elements that can be defined in an XML schema, including: 1) Simple elements with or without attributes 2) Complex elements with child elements and/or attributes 3) Elements with simple content but attributes 4) Elements with simple content and restrictions It also describes how to define attributes without or with restrictions, and how to reuse simple or complex types by assigning them a name and referencing that name. The number of elements can be specified using minOccurs and maxOccurs.

Uploaded by

pakinoww
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

XML SCHEMES

1- Elements
a. Elements amb contingut simple i sense atributs: <xs:element name=XXX type=xs:string/integer/float/.../> b. Elements amb contingut complex (cont subelements) i/o atributs: <xs:element name= > <xs:complexType> <xs:sequence | choice | all > (Llista de sub elements) </xs:sequence | choice | all> <xs:attribute /> (Llista datributs) </xs:complexType> </xs:element> EX: <alumne num=14> <nom> Francesc </nom> <cognom>Julia</cognom> </alumne> <xs:element name=alumne > <xs:complexType> <xs:sequence> <xs:element name="nom" type="xs:string" /> <xs:element name="cognom" type="xs:string" /> </xs:sequence> <xs:attribute name="num" type="xs:integer"/> </xs:complexType> </xs:element> Variant: <xs:element name= > <xs:complextype> <xs:sequence | choice | all mixed=true> (Llista de sub elements) </xs:sequence | choice | all> <xs:attribute /> (Llista datributs) </xs:complextype> </xs:element> EX: <alumne num=14> Les dades son <nom> Francesc </nom> <cognom>Julia</cognom> </alumne>

s possible ficar el text Les dades son gracies al mixed=true

c. Element sense sub elements per amb un o varis atributs: <xs:element> <xs:complextype> <xs:simpleContent> <xs:extension base=xs:(tipus de contingut:cadena,etc)> <xs:attribute /> </xs:extension> </xs:extension> </xs:simpleContent> </xs:complextype> </xs:element> EX: <alumne num=14 > Frances Juli</alumne> <xs:element> <xs:complexType> <xs:simpleContent> <xs:extension base=xs:string> <xs:attribute name="num" type="xs:integer" /> </xs:extension> </xs:simpleContent> </xs:complextype> </xs:element>

d. Element amb contingut simple i restricci: <xs:element name= > <xs:simpleType> <xs:restriction base=xs: (tipus per defecte)> <XXX> (tipus de restriccio) </xs:restriction> </xs:simpleType> </xs:element> Tipus restriccions: <xs:pattern value= >, <xs: minLength value= >, <xs:maxLength value= >, <xs:enumeration value= >, <xs:minInclusive value= >, <xs:maxInclusive value= > EX: <alumne> Francesc Julia </alumne>

<xs:element name=alumne > <xs:simpleType> <xs:restriction base=xs:string> <xs:pattern value=([A-Za-z])* /> </xs:restriction> </xs:simpleType> </xs:element>

2- Atributs
a. Atributs sense restriccions <xs:attribute name= type= use= (required o opcional) default= (valor per defecte) /> b. Atributs amb restriccions <xs:attribute name= type= use= (required o opcional) default= (valor per defecte) > <xs:simpleType base=xs: (tipus per defecte)> </xs:simpleType> </xs:attribut>

3- Reutilitzaci de tipus simple/complex


a. Assignaci dun nom al tipus <xs:simpleType/complexType name=nomtipus> .... </xs:simpleType/complexType> b. Utilitzaci del nou tipus <xs:element name= type=(nom del tipus)" /> <xs:attribute name= type=(nom del tipus)" />

4- Especificaci del nmero d'elements


minOccurs o maxOccurs, amb valors 0, enter positiu o unbounded

You might also like