Xml p3 -Lecture Notes
- 2. xsd
Schema --- 1.Simple type(no child,attributes)
restriction,built in data types.
2.Complex type(can contain)
Simple content----no child,extension,restriction.
Complex content------child,no limitations
2
- 4. Top Layer
<?xml version="1.0"?>
<note xmlns="https://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"
xsi:schemaLocation="https://www.w3schools.com
note.xsd">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
4
- 8. Complex type
<product pid="1345"/>
<employee>
<firstname>John</firstname>
<lastname>Smith</lastname>
</employee>
<food type="dessert">Ice cream</food>
<description>
It happened
on <date lang="norwegian">03.03.99</date> ....
</description>
8
- 31. Complex type
<xmlversion=1.0>
<schemaxmlns=http://www.w3.org/2001/XMLSchema
xmlns:computer=
targetnamespace=>
<simpleTypename=gigahertz>
<restrictionbase=decimal>
<mininclusivevalue=2.1/>
</restriction>
</simpleType>
<complexTypename=CPU>
<simpleContent>
<extensionbase=string>
<attributename=modeltype=string/>
</extension>
</simpleContent>
</complexType>
31
- 32. Complex type
<complexTypename=portable>
<all>
<elementname=processortype=computer:cpu/>
<elementname=monitortype=int/>
<elementname=CPUSpeedtype=computer:gigahertz/>
<elementname=RAMtype=int/>
</all>
<attributename=manufacturertype=string/>
</complexType>
<elementname=laptoptype=computer:portable/>
</schema>
32