Aloha Snackbar: Difference between revisions
From ICO wiki
Jump to navigationJump to search
Created page with "hep" |
No edit summary |
||
Line 1: | Line 1: | ||
== Meeskond ja rollid == | |||
*'''Egert Aia''' - Kuri Näärivana - karjub, lõugab ja kamandab (loe: projektijuht) | |||
*'''Merit Ridaste''' - Kimbutav Grinch - kannab kaasas mappi, teab kõike, mis on seotud kuupäevadega(loe: kordinaator) | |||
*'''Ants-Kristjan Rooma''' - TO BE DETERMINED | |||
*'''Siim Ivask''' - TO BE DETERMINED | |||
== Idee == | |||
Kas teate seda tunnet, et teil pole arvutit ning sooviksite, et kusagilt oleks võimalik üheks õhtuks laenutada endale arvuti, et testida kas spetsifikatsioonid on teile kohased? Meie küll teame - ning sestap kannabki meie projekt nime Arvutirent. | |||
Põhimissioon on valmistada töötav veebirakendus kus kasutajal oleks võimalik rentida arvuti ning hiljem see ka endale soetada kui tegemist on tõepoolest hea arvutiga. | |||
Rendi pikkusest ning lepingutest sõltuvalt esitatakse kliendile arve. | |||
Adminniliidesest on võimalik arvuteid lisada/kustutada | |||
Kasutajaliidesest rentida/osta. | |||
== Kasutatav tehnoloogia == | |||
TO BE DETERMINED | |||
== Rakenduse sisu == | |||
=== Rakenduses on olemas järgmised võimalused (Must have): === | |||
=== Rakenduses võiksid olla lisavõimalused (Should have): === | |||
== Andmebaasiskeem == | |||
TO BE CREATED | |||
== Esimene etapp == | |||
* Luua XML fail vabalt valitud andmete edastamiseks | |||
* Luua sellele faili skeemifail | |||
* XSL fail(id) erinevate transformatsioonide tarvis | |||
=== XML Fail === | |||
{{<source lang="xml" | multiline=> | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Computers> | |||
<!--Example of laptop: gaming--> | |||
<Computer id ="1" type="laptop" purpose ="gaming"> | |||
<Generals> | |||
<General property="color"><![CDATA[Silver]]></General> | |||
<General property="release"><![CDATA[2016]]></General> | |||
<General property="os" type ="64-bit"><![CDATA[Windows 10, Home]]></General> | |||
<General property="manufactorer"><![CDATA[AlienWare]]></General> | |||
</Generals> | |||
<Parameters> | |||
<parameter property="battery" unit="h"><![CDATA[6,5]]></parameter> | |||
<parameter property="weight" unit="kg"><![CDATA[3,78]]></parameter> | |||
<parameter property="depth" unit ="cm"><![CDATA[29,19]]></parameter> | |||
<parameter property="width" unit="cm"><![CDATA[43]]></parameter> | |||
<parameter property="height" unit ="cm"><![CDATA[3,44]]></parameter> | |||
</Parameters> | |||
<components> | |||
<component property="processor" type="i7" speed ="2-3Gz" manufactorer="Intel®"><![CDATA[Core™ 6700HQ]]></component> | |||
<component property="videocard" type="GDDR5" manufactorer="NVIDIA®" serie="GeForce™" vram="3072" vram_unit="MB"><![CDATA[GTX 970M]]></component> | |||
<component property="storage" type="SSD" unit="GB"><![CDATA[256]]></component> | |||
<component property="storage" type="HDD" speed="7200 p/m" unit="GB"><![CDATA[1000]]></component> | |||
<component property="ram" type ="DDR4" unit="GB"><![CDATA[16]]></component> | |||
</components> | |||
<interfaces> | |||
<inputs> | |||
<input amount="3"><![CDATA[USB 3.0]]></input> | |||
<input amount="1"><![CDATA[HDMI]]></input> | |||
<input amount="1"><![CDATA[Mini-DP]]></input> | |||
<input amount="1"><![CDATA[Microphone]]></input> | |||
</inputs> | |||
<outputs> | |||
<output amount="1"><![CDATA[Headset]]></output> | |||
</outputs> | |||
</interfaces> | |||
<communications> | |||
<communication type="Wifi"> <![CDATA[IEEE 802.11bc, IEEE 802.11gc, IEEE 802.11nc, IEEE 802.11a]]></communication> | |||
<communication type="Bluetooth" version="4.1"><![CDATA[Bluetooth]]></communication> | |||
</communications> | |||
<screeninfos> | |||
<monitor number="1"> | |||
<screeninfo property="resolution" type="FullHD"><![CDATA[1920x1080]]></screeninfo> | |||
<screeninfo property="size" unit="inch"><![CDATA[17,3]]></screeninfo> | |||
<screeninfo property="surface"><![CDATA[matt]]></screeninfo> | |||
<screeninfo property="screen type"><![CDATA[LED IPS]]></screeninfo> | |||
<screeninfo property="touchscreen"><![CDATA[Yes]]></screeninfo> | |||
</monitor> | |||
</screeninfos> | |||
<gears> | |||
<gear property="bag" type="laptop"><![CDATA[Yes]]></gear> | |||
<gear property="charger" cells="8" W="240"><![CDATA[Yes]]></gear> | |||
</gears> | |||
<Informations> | |||
<information type="price" unit="EUR"><![CDATA[2340]]></information> | |||
<information type="rent price" unit="EUR/day"><![CDATA[50]]></information> | |||
</Informations> | |||
</Computer> | |||
<!--Example of laptop: home--> | |||
<Computer id ="2" type="laptop" purpose ="home"> | |||
<Generals> | |||
<General property="color"><![CDATA[White]]></General> | |||
<General property="release"><![CDATA[2015]]></General> | |||
<General property="os" type ="64-bit"><![CDATA[Windows 8, Home]]></General> | |||
<General property="manufactorer"><![CDATA[HP]]></General> | |||
</Generals> | |||
<Parameters> | |||
<parameter property="battery" unit="h"><![CDATA[5,5]]></parameter> | |||
<parameter property="weight" unit="kg"><![CDATA[1,68]]></parameter> | |||
<parameter property="depth" unit ="cm"><![CDATA[24,4]]></parameter> | |||
<parameter property="width" unit="cm"><![CDATA[34]]></parameter> | |||
<parameter property="height" unit ="cm"><![CDATA[1,99]]></parameter> | |||
</Parameters> | |||
<components> | |||
<component property="processor" type="i5" speed ="2,3-2,8Gz" manufactorer="Intel®"><![CDATA[Core™ 6200U]]></component> | |||
<component property="videocard" type="DDR3" manufactorer="Intel®" serie="HD"><![CDATA[520]]></component> | |||
<component property="storage" type="SSD" unit="GB"><![CDATA[128]]></component> | |||
<component property="ram" type ="DDR3" unit="GB"><![CDATA[16]]></component> | |||
</components> | |||
<interfaces> | |||
<inputs> | |||
<input amount="2"><![CDATA[USB 3.0]]></input> | |||
<input amount="1"><![CDATA[USB 2.0]]></input> | |||
<input amount="1"><![CDATA[HDMI]]></input> | |||
<input amount="1"><![CDATA[VGA]]></input> | |||
<input amount="1"><![CDATA[Microphone]]></input> | |||
</inputs> | |||
<outputs> | |||
<output amount="1"><![CDATA[Headset]]></output> | |||
</outputs> | |||
</interfaces> | |||
<communications> | |||
<communication type="Wifi"> <![CDATA[IEEE 802.11bc, IEEE 802.11gc, IEEE 802.11nc, IEEE 802.11a]]></communication> | |||
<communication type="Bluetooth" version="4.0"><![CDATA[Bluetooth]]></communication> | |||
</communications> | |||
<screeninfos> | |||
<monitor number="1"> | |||
<screeninfo property="resolution" type="HD"><![CDATA[1366x768]]></screeninfo> | |||
<screeninfo property="size" unit="inch"><![CDATA[14]]></screeninfo> | |||
<screeninfo property="surface"><![CDATA[matt]]></screeninfo> | |||
<screeninfo property="screen type"><![CDATA[LED]]></screeninfo> | |||
<screeninfo property="touchscreen"><![CDATA[No]]></screeninfo> | |||
</monitor> | |||
</screeninfos> | |||
<gears> | |||
<gear property="bag" type="laptop"><![CDATA[Yes]]></gear> | |||
<gear property="charger" cells="4" W="45"><![CDATA[Yes]]></gear> | |||
</gears> | |||
<extras> | |||
<extra><![CDATA[Id-card reader]]></extra> | |||
<extra><![CDATA[CD-Drive]]></extra> | |||
<extra type="Multi-in-1" supports="SD, SDHC, SDXC"><![CDATA[Memory-card reader]]></extra> | |||
</extras> | |||
<Informations> | |||
<information type="price" unit="EUR"><![CDATA[720]]></information> | |||
<information type="rent price" unit="EUR/day"><![CDATA[30]]></information> | |||
</Informations> | |||
</Computer> | |||
<!--Example of laptop: office--> | |||
<Computer id ="3" type="laptop" purpose ="office"> | |||
<Generals> | |||
<General property="color"><![CDATA[Red]]></General> | |||
<General property="release"><![CDATA[2015]]></General> | |||
<General property="os" type ="64-bit"><![CDATA[Windows 8.1]]></General> | |||
<General property="manufactorer"><![CDATA[Dell]]></General> | |||
</Generals> | |||
<Parameters> | |||
<parameter property="battery" unit="h"><![CDATA[6,5]]></parameter> | |||
<parameter property="weight" unit="kg"><![CDATA[2,11]]></parameter> | |||
<parameter property="depth" unit ="cm"><![CDATA[29,12]]></parameter> | |||
<parameter property="width" unit="cm"><![CDATA[37,78]]></parameter> | |||
<parameter property="height" unit ="cm"><![CDATA[1,99]]></parameter> | |||
</Parameters> | |||
<components> | |||
<component property="processor" type="i7" speed ="2,4-3,0Gz" manufactorer="Intel®"><![CDATA[Core™ 5500U]]></component> | |||
<component property="videocard" type="GDDR5" manufactorer="AMD" serie="Radeon" vram="4096" vram_unit="MB"><![CDATA[R7 M270]]></component> | |||
<component property="storage" type="SSD" unit="GB"><![CDATA[256]]></component> | |||
<component property="ram" type ="DDR4" unit="GB"><![CDATA[16]]></component> | |||
</components> | |||
<interfaces> | |||
<inputs> | |||
<input amount="2"><![CDATA[USB 3.0]]></input> | |||
<input amount="1"><![CDATA[USB 2.0]]></input> | |||
<input amount="1"><![CDATA[HDMI]]></input> | |||
<input amount="1"><![CDATA[Microphone]]></input> | |||
</inputs> | |||
<outputs> | |||
<output amount="1"><![CDATA[Headset]]></output> | |||
</outputs> | |||
</interfaces> | |||
<communications> | |||
<communication type="Wifi"> <![CDATA[IEEE 802.11bc, IEEE 802.11gc, IEEE 802.11nc, IEEE 802.11a]]></communication> | |||
<communication type="Bluetooth" version="4.0"><![CDATA[Bluetooth]]></communication> | |||
</communications> | |||
<screeninfos> | |||
<monitor number="1"> | |||
<screeninfo property="resolution" type="UltraHD"><![CDATA[3840x2160]]></screeninfo> | |||
<screeninfo property="size" unit="inch"><![CDATA[15,6]]></screeninfo> | |||
<screeninfo property="surface"><![CDATA[shiny]]></screeninfo> | |||
<screeninfo property="screen type"><![CDATA[LED IPS]]></screeninfo> | |||
<screeninfo property="touchscreen"><![CDATA[No]]></screeninfo> | |||
</monitor> | |||
</screeninfos> | |||
<gears> | |||
<gear property="bag" type="laptop"><![CDATA[Yes]]></gear> | |||
<gear property="charger" cells="4" W="65"><![CDATA[Yes]]></gear> | |||
</gears> | |||
<extras> | |||
<extra><![CDATA[Id-card reader]]></extra> | |||
<extra><![CDATA[CD-Drive]]></extra> | |||
<extra type="Multi-in-1" supports="SD, SDHC, SDXC"><![CDATA[Memory-card reader]]></extra> | |||
</extras> | |||
<Informations> | |||
<information type="price" unit="EUR"><![CDATA[1700]]></information> | |||
<information type="rent price" unit="EUR/day"><![CDATA[40]]></information> | |||
</Informations> | |||
</Computer> | |||
<!--Example of PC: gaming--> | |||
<Computer id ="4" type="PC" purpose ="gaming"> | |||
<Generals> | |||
<General property="color"><![CDATA[Black]]></General> | |||
<General property="release"><![CDATA[2015]]></General> | |||
<General property="os" type ="64-bit"><![CDATA[Windows 10, Home]]></General> | |||
<General property="manufactorer"><![CDATA[AlienWare]]></General> | |||
</Generals> | |||
<Parameters> | |||
<parameter property="weight" unit="kg"><![CDATA[3,6]]></parameter> | |||
<parameter property="depth" unit ="cm"><![CDATA[20,32]]></parameter> | |||
<parameter property="width" unit="cm"><![CDATA[20,32]]></parameter> | |||
<parameter property="height" unit ="cm"><![CDATA[7,62]]></parameter> | |||
</Parameters> | |||
<components> | |||
<component property="processor" type="i7" speed ="2,0-3,0Gz" manufactorer="Intel®"><![CDATA[Core™ 4765T]]></component> | |||
<component property="videocard" type="GDDR5" manufactorer="NVIDIA®" serie="GeForce™" vram="3072" vram_unit="MB"><![CDATA[GTX 970M]]></component> | |||
<component property="storage" type="SSD" unit="GB"><![CDATA[256]]></component> | |||
<component property="storage" type="HDD" speed="7200 p/m" unit="TB"><![CDATA[1]]></component> | |||
<component property="ram" type ="DDR4" unit="GB"><![CDATA[16]]></component> | |||
</components> | |||
<interfaces> | |||
<inputs> | |||
<input amount="4"><![CDATA[USB 3.0]]></input> | |||
<input amount="2"><![CDATA[USB 2.0]]></input> | |||
<input amount="1"><![CDATA[HDMI]]></input> | |||
<input amount="1"><![CDATA[Mini-DP]]></input> | |||
<input amount="1"><![CDATA[Microphone]]></input> | |||
</inputs> | |||
<outputs> | |||
<output amount="1"><![CDATA[Headset]]></output> | |||
</outputs> | |||
</interfaces> | |||
<communications> | |||
<communication type="Wifi"> <![CDATA[IEEE 802.11bc, IEEE 802.11gc, IEEE 802.11nc, IEEE 802.11a]]></communication> | |||
<communication type="Bluetooth" version="4.1"><![CDATA[Bluetooth]]></communication> | |||
</communications> | |||
<gears> | |||
<gear property="cables"><![CDATA[Yes]]></gear> | |||
</gears> | |||
<extras> | |||
<extra><![CDATA[Id-card reader]]></extra> | |||
<extra><![CDATA[DVD-Drive]]></extra> | |||
<extra type="Multi-in-1" supports="SD, SDHC, SDXC"><![CDATA[Memory-card reader]]></extra> | |||
</extras> | |||
<Informations> | |||
<information type="price" unit="EUR"><![CDATA[2340]]></information> | |||
<information type="rent price" unit="EUR/day"><![CDATA[75]]></information> | |||
</Informations> | |||
</Computer> | |||
</Computers> | |||
</source> | |||
=== XML Validaator === | |||
<source lang="csharp"> | |||
static void Main(string[] args) | |||
{ | |||
XmlSchemaSet schemas = new XmlSchemaSet(); | |||
//Change this line for your own place of the file | |||
schemas.Add("", "C:/Users/Egert/Dropbox/programming/VISUALSPACE/arvutirent/WebApi.Arvutirent/XML_Data/Arvutirent.xsd"); | |||
Console.WriteLine("Attempting to validate"); | |||
//Change this line for your own place of the file | |||
XDocument custOrdDoc = XDocument.Load("C:/Users/Egert/Dropbox/programming/VISUALSPACE/arvutirent/WebApi.Arvutirent/XML_Data/Arvutirent.xml"); | |||
bool errors = false; | |||
custOrdDoc.Validate(schemas, (o, e) => | |||
{ | |||
Console.WriteLine("{0}", e.Message); | |||
errors = true; | |||
}); | |||
Console.WriteLine("custOrdDoc {0}", errors ? "did not validate" : "validated"); | |||
Console.WriteLine(); | |||
} | |||
</source> | |||
=== XSD Fail === | |||
<source lang="xml"> | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |||
<xs:element name="Computers"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="Computer"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="Generals"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="General"> | |||
<xs:complexType> | |||
<xs:simpleContent> | |||
<xs:extension base="xs:string"> | |||
<xs:attribute name="property" type="xs:string" use="required" /> | |||
<xs:attribute name="type" type="xs:string" use="optional" /> | |||
</xs:extension> | |||
</xs:simpleContent> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="Parameters"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="parameter"> | |||
<xs:complexType> | |||
<xs:simpleContent> | |||
<xs:extension base="xs:string"> | |||
<xs:attribute name="property" type="xs:string" use="required" /> | |||
<xs:attribute name="unit" type="xs:string" use="required" /> | |||
</xs:extension> | |||
</xs:simpleContent> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="components"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="component"> | |||
<xs:complexType> | |||
<xs:simpleContent> | |||
<xs:extension base="xs:string"> | |||
<xs:attribute name="property" type="xs:string" use="required" /> | |||
<xs:attribute name="type" type="xs:string" use="required" /> | |||
<xs:attribute name="speed" type="xs:string" use="optional" /> | |||
<xs:attribute name="manufactorer" type="xs:string" use="optional" /> | |||
<xs:attribute name="serie" type="xs:string" use="optional" /> | |||
<xs:attribute name="vram" type="xs:unsignedShort" use="optional" /> | |||
<xs:attribute name="vram_unit" type="xs:string" use="optional" /> | |||
<xs:attribute name="unit" type="xs:string" use="optional" /> | |||
</xs:extension> | |||
</xs:simpleContent> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="interfaces"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="inputs"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="input"> | |||
<xs:complexType> | |||
<xs:simpleContent> | |||
<xs:extension base="xs:string"> | |||
<xs:attribute name="amount" type="xs:unsignedByte" use="required" /> | |||
</xs:extension> | |||
</xs:simpleContent> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="outputs"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="output"> | |||
<xs:complexType> | |||
<xs:simpleContent> | |||
<xs:extension base="xs:string"> | |||
<xs:attribute name="amount" type="xs:unsignedByte" use="required" /> | |||
</xs:extension> | |||
</xs:simpleContent> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="communications"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="communication"> | |||
<xs:complexType> | |||
<xs:simpleContent> | |||
<xs:extension base="xs:string"> | |||
<xs:attribute name="type" type="xs:string" use="required" /> | |||
<xs:attribute name="version" type="xs:decimal" use="optional" /> | |||
</xs:extension> | |||
</xs:simpleContent> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element minOccurs="0" name="screeninfos"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element name="monitor"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="screeninfo"> | |||
<xs:complexType> | |||
<xs:simpleContent> | |||
<xs:extension base="xs:string"> | |||
<xs:attribute name="property" type="xs:string" use="required" /> | |||
<xs:attribute name="type" type="xs:string" use="optional" /> | |||
<xs:attribute name="unit" type="xs:string" use="optional" /> | |||
</xs:extension> | |||
</xs:simpleContent> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
<xs:attribute name="number" type="xs:int" use="required"/> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="gears"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="gear"> | |||
<xs:complexType> | |||
<xs:simpleContent> | |||
<xs:extension base="xs:string"> | |||
<xs:attribute name="property" type="xs:string" use="required" /> | |||
<xs:attribute name="type" type="xs:string" use="optional" /> | |||
<xs:attribute name="cells" type="xs:unsignedByte" use="optional" /> | |||
<xs:attribute name="W" type="xs:unsignedByte" use="optional" /> | |||
</xs:extension> | |||
</xs:simpleContent> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element minOccurs="0" name="extras"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="extra"> | |||
<xs:complexType> | |||
<xs:simpleContent> | |||
<xs:extension base="xs:string"> | |||
<xs:attribute name="type" type="xs:string" use="optional" /> | |||
<xs:attribute name="supports" type="xs:string" use="optional" /> | |||
</xs:extension> | |||
</xs:simpleContent> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
<xs:element name="Informations"> | |||
<xs:complexType> | |||
<xs:sequence> | |||
<xs:element maxOccurs="unbounded" name="information"> | |||
<xs:complexType> | |||
<xs:simpleContent> | |||
<xs:extension base="xs:string"> | |||
<xs:attribute name="type" type="xs:string" use="required" /> | |||
<xs:attribute name="unit" type="xs:string" use="required" /> | |||
</xs:extension> | |||
</xs:simpleContent> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
<xs:attribute name="id" type="xs:unsignedInt" use="required" /> | |||
<xs:attribute name="type" type="xs:string" use="required" /> | |||
<xs:attribute name="purpose" type="xs:string" use="required" /> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:sequence> | |||
</xs:complexType> | |||
</xs:element> | |||
</xs:schema> | |||
</source> | |||
=== XLST: Näita kõiki arvuteid === | |||
<source lang="xml"> | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |||
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" | |||
> | |||
<xsl:output method="html" indent="yes"/> | |||
<xsl:template match="/"> | |||
<html> | |||
<head> | |||
<title>All Computers</title> | |||
</head> | |||
<body> | |||
<h1> All computers in our project</h1> | |||
<ul> | |||
<xsl:for-each select="/Computers/Computer"> | |||
<!-- All computers--> | |||
<li> | |||
<h2><xsl:value-of select= "concat(@type, '.', @purpose, ' id:', @id )"/></h2> | |||
General Info: | |||
<ul> | |||
<xsl:for-each select="Generals/General"> | |||
<li> | |||
<xsl:value-of select="concat(@property, ': ', ., ' ',@type)"/> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
Parameters: | |||
<ul> | |||
<xsl:for-each select="Parameters/parameter"> | |||
<li> | |||
<xsl:value-of select="concat(@property, ': ', ., @unit)"/> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
Components: | |||
<ul> | |||
<xsl:for-each select="components/component"> | |||
<li> | |||
<xsl:if test="@property = 'processor'"> | |||
<xsl:value-of select="concat(@property, ': ', @manufactorer, ' ', @type, ' ', .,' ', @speed) "/> | |||
</xsl:if> | |||
<xsl:if test="@property = 'videocard'"> | |||
<xsl:value-of select="concat(@property, ': ', @manufactorer, ' ', @serie, ' ', .,' ', @type, ' ', @vram, @vram_unit) "/> | |||
</xsl:if> | |||
<xsl:if test="@property = 'storage' or @property = 'ram'"> | |||
<xsl:value-of select="concat(@property, ': ', ., @unit,' ', @type) "/> | |||
</xsl:if> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
Interfaces: | |||
<ul> | |||
<xsl:for-each select="interfaces"> | |||
<li> | |||
<b>INPUTS</b><br/> | |||
<ul> | |||
<xsl:for-each select="inputs/input"> | |||
<xsl:value-of select="concat(@amount,' x ',.)"/> | |||
<br/> | |||
</xsl:for-each> | |||
</ul> | |||
</li> | |||
<li> | |||
<b>OUTPUTS</b><br/> | |||
<ul> | |||
<xsl:for-each select="outputs/output"> | |||
<xsl:value-of select="concat(@amount,' x ', . )"/><br/> | |||
</xsl:for-each> | |||
</ul> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
Communications: | |||
<ul> | |||
<xsl:for-each select="communications/communication"> | |||
<li> | |||
<xsl:value-of select="concat(@type, @version,': ', .)"/> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
<xsl:for-each select="screeninfos"> | |||
<xsl:choose> | |||
<xsl:when test="monitor"> | |||
Screen Information: | |||
<ul> | |||
<xsl:for-each select="monitor"> | |||
<li> | |||
<xsl:value-of select="concat('Monitor', @number)"/> | |||
<br/> | |||
<ul> | |||
<xsl:for-each select="screeninfo"> | |||
<xsl:value-of select="concat(@property, ': ', . ,' ', @type, @unit)"/><br/> | |||
</xsl:for-each> | |||
</ul> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
</xsl:when> | |||
</xsl:choose> | |||
</xsl:for-each> | |||
Gear Information: | |||
<xsl:for-each select="gears"> | |||
<xsl:choose> | |||
<xsl:when test="count(gear) > 0"> | |||
<ul> | |||
<xsl:for-each select="gear"> | |||
<li> | |||
<xsl:value-of select="@property"/> | |||
<br/></li> | |||
</xsl:for-each> | |||
</ul> | |||
</xsl:when> | |||
<xsl:otherwise> | |||
<ul>No Gear information available</ul> | |||
</xsl:otherwise> | |||
</xsl:choose> | |||
</xsl:for-each> | |||
Informations: | |||
<ul> | |||
<xsl:for-each select="Informations/information"> | |||
<xsl:value-of select="concat(@type, ' ', ., ' ', @unit)"/><br/> | |||
</xsl:for-each> | |||
</ul> | |||
</li> | |||
<br/> | |||
</xsl:for-each> | |||
</ul> | |||
</body> | |||
</html> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</source> | |||
=== XLST: Näita arvuteid millel on rohkem või täpselt kolm USB 3.0 porti === | |||
<source lang="xml"> | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |||
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" | |||
> | |||
<xsl:output method="html" indent="yes"/> | |||
<xsl:template match="/"> | |||
<html> | |||
<head> | |||
<title>All Computers</title> | |||
</head> | |||
<body> | |||
<h1> Computers with 3 or more USB 3.0 ports</h1> | |||
<ul> | |||
<xsl:for-each select="/Computers/Computer"> | |||
<!-- All computers--> | |||
<xsl:if test="@id = 1 or @id = 4"> | |||
<!--sellest v2ga rohkem neegrimaks ei l2he. Manuaalselt on ette antud, et millistel arvutitel on 3vRohkem USB 3.0 porti. | |||
Kui mingi 100 arvutit on, siis see ei sobi. Kui uue arvuti projekti lisame, siis tuleks manuaalselt see ka siia lisada (juhul kui arvutil on 3vRohkem USB 3.0 porti).--> | |||
<h2> | |||
<xsl:value-of select= "concat(@type, '.', @purpose, ' id:', @id )"/> | |||
</h2> | |||
Interfaces: | |||
<ul> | |||
<xsl:for-each select="interfaces"> | |||
<li> | |||
<b>INPUTS</b> | |||
<br/> | |||
<ul> | |||
<xsl:for-each select="inputs/input"> | |||
<xsl:value-of select="concat(@amount,' x ',.)"/> | |||
<br/> | |||
</xsl:for-each> | |||
</ul> | |||
</li> | |||
<li> | |||
<b>OUTPUTS</b> | |||
<br/> | |||
<ul> | |||
<xsl:for-each select="outputs/output"> | |||
<xsl:value-of select="concat(@amount,' x ', . )"/> | |||
<br/> | |||
</xsl:for-each> | |||
</ul> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
General Info: | |||
<ul> | |||
<xsl:for-each select="Generals/General"> | |||
<li> | |||
<xsl:value-of select="concat(@property, ': ', ., ' ',@type)"/> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
Parameters: | |||
<ul> | |||
<xsl:for-each select="Parameters/parameter"> | |||
<li> | |||
<xsl:value-of select="concat(@property, ': ', ., @unit)"/> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
Components: | |||
<ul> | |||
<xsl:for-each select="components/component"> | |||
<li> | |||
<xsl:if test="@property = 'processor'"> | |||
<xsl:value-of select="concat(@property, ': ', @manufactorer, ' ', @type, ' ', .,' ', @speed) "/> | |||
</xsl:if> | |||
<xsl:if test="@property = 'videocard'"> | |||
<xsl:value-of select="concat(@property, ': ', @manufactorer, ' ', @serie, ' ', .,' ', @type, ' ', @vram, @vram_unit) "/> | |||
</xsl:if> | |||
<xsl:if test="@property = 'storage' or @property = 'ram'"> | |||
<xsl:value-of select="concat(@property, ': ', ., @unit,' ', @type) "/> | |||
</xsl:if> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
Communications: | |||
<ul> | |||
<xsl:for-each select="communications/communication"> | |||
<li> | |||
<xsl:value-of select="concat(@type, @version,': ', .)"/> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
<xsl:for-each select="screeninfos"> | |||
<xsl:choose> | |||
<xsl:when test="monitor"> | |||
Screen Information: | |||
<ul> | |||
<xsl:for-each select="monitor"> | |||
<li> | |||
<xsl:value-of select="concat('Monitor', @number)"/> | |||
<br/> | |||
<ul> | |||
<xsl:for-each select="screeninfo"> | |||
<xsl:value-of select="concat(@property, ': ', . ,' ', @type, @unit)"/> | |||
<br/> | |||
</xsl:for-each> | |||
</ul> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
</xsl:when> | |||
</xsl:choose> | |||
</xsl:for-each> | |||
Gear Information: | |||
<xsl:for-each select="gears"> | |||
<xsl:choose> | |||
<xsl:when test="count(gear) > 0"> | |||
<ul> | |||
<xsl:for-each select="gear"> | |||
<li> | |||
<xsl:value-of select="@property"/> | |||
<br/> | |||
</li> | |||
</xsl:for-each> | |||
</ul> | |||
</xsl:when> | |||
<xsl:otherwise> | |||
<ul>No Gear information available</ul> | |||
</xsl:otherwise> | |||
</xsl:choose> | |||
</xsl:for-each> | |||
Informations: | |||
<ul> | |||
<xsl:for-each select="Informations/information"> | |||
<xsl:value-of select="concat(@type, ' ', ., ' ', @unit)"/> | |||
<br/> | |||
</xsl:for-each> | |||
</ul> | |||
<br/> | |||
</xsl:if> | |||
</xsl:for-each> | |||
</ul> | |||
</body> | |||
</html> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</source> | |||
=== XLST: Näita arvuteid millel on i7 protsessor === | |||
<source lang="xml"> | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |||
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" | |||
> | |||
<xsl:output method="html" indent="yes"/> | |||
<xsl:template match="@* | node()"> | |||
<html> | |||
<head> | |||
<title>Computers with i7</title> | |||
</head> | |||
<body> | |||
<h1>Computers with i7 processor</h1> | |||
<xsl:for-each select="/Computers/Computer"> | |||
<xsl:variable name="compName" select="concat(@purpose, ' ', @type, ' id:', @id )"></xsl:variable> | |||
<xsl:if test="components/component/@type='i7'"> | |||
<p> | |||
<xsl:value-of select="$compName"/> | |||
</p> | |||
</xsl:if> | |||
</xsl:for-each> | |||
</body> | |||
</html> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</source> |
Revision as of 12:53, 19 March 2016
Meeskond ja rollid
- Egert Aia - Kuri Näärivana - karjub, lõugab ja kamandab (loe: projektijuht)
- Merit Ridaste - Kimbutav Grinch - kannab kaasas mappi, teab kõike, mis on seotud kuupäevadega(loe: kordinaator)
- Ants-Kristjan Rooma - TO BE DETERMINED
- Siim Ivask - TO BE DETERMINED
Idee
Kas teate seda tunnet, et teil pole arvutit ning sooviksite, et kusagilt oleks võimalik üheks õhtuks laenutada endale arvuti, et testida kas spetsifikatsioonid on teile kohased? Meie küll teame - ning sestap kannabki meie projekt nime Arvutirent. Põhimissioon on valmistada töötav veebirakendus kus kasutajal oleks võimalik rentida arvuti ning hiljem see ka endale soetada kui tegemist on tõepoolest hea arvutiga.
Rendi pikkusest ning lepingutest sõltuvalt esitatakse kliendile arve.
Adminniliidesest on võimalik arvuteid lisada/kustutada Kasutajaliidesest rentida/osta.
Kasutatav tehnoloogia
TO BE DETERMINED
Rakenduse sisu
Rakenduses on olemas järgmised võimalused (Must have):
Rakenduses võiksid olla lisavõimalused (Should have):
Andmebaasiskeem
TO BE CREATED
Esimene etapp
- Luua XML fail vabalt valitud andmete edastamiseks
- Luua sellele faili skeemifail
- XSL fail(id) erinevate transformatsioonide tarvis
XML Fail
{{
<?xml version="1.0" encoding="utf-8"?>
<Computers>
<!--Example of laptop: gaming-->
<Computer id ="1" type="laptop" purpose ="gaming">
<Generals>
<General property="color"><![CDATA[Silver]]></General>
<General property="release"><![CDATA[2016]]></General>
<General property="os" type ="64-bit"><![CDATA[Windows 10, Home]]></General>
<General property="manufactorer"><![CDATA[AlienWare]]></General>
</Generals>
<Parameters>
<parameter property="battery" unit="h"><![CDATA[6,5]]></parameter>
<parameter property="weight" unit="kg"><![CDATA[3,78]]></parameter>
<parameter property="depth" unit ="cm"><![CDATA[29,19]]></parameter>
<parameter property="width" unit="cm"><![CDATA[43]]></parameter>
<parameter property="height" unit ="cm"><![CDATA[3,44]]></parameter>
</Parameters>
<components>
<component property="processor" type="i7" speed ="2-3Gz" manufactorer="Intel®"><![CDATA[Core™ 6700HQ]]></component>
<component property="videocard" type="GDDR5" manufactorer="NVIDIA®" serie="GeForce™" vram="3072" vram_unit="MB"><![CDATA[GTX 970M]]></component>
<component property="storage" type="SSD" unit="GB"><![CDATA[256]]></component>
<component property="storage" type="HDD" speed="7200 p/m" unit="GB"><![CDATA[1000]]></component>
<component property="ram" type ="DDR4" unit="GB"><![CDATA[16]]></component>
</components>
<interfaces>
<inputs>
<input amount="3"><![CDATA[USB 3.0]]></input>
<input amount="1"><![CDATA[HDMI]]></input>
<input amount="1"><![CDATA[Mini-DP]]></input>
<input amount="1"><![CDATA[Microphone]]></input>
</inputs>
<outputs>
<output amount="1"><![CDATA[Headset]]></output>
</outputs>
</interfaces>
<communications>
<communication type="Wifi"> <![CDATA[IEEE 802.11bc, IEEE 802.11gc, IEEE 802.11nc, IEEE 802.11a]]></communication>
<communication type="Bluetooth" version="4.1"><![CDATA[Bluetooth]]></communication>
</communications>
<screeninfos>
<monitor number="1">
<screeninfo property="resolution" type="FullHD"><![CDATA[1920x1080]]></screeninfo>
<screeninfo property="size" unit="inch"><![CDATA[17,3]]></screeninfo>
<screeninfo property="surface"><![CDATA[matt]]></screeninfo>
<screeninfo property="screen type"><![CDATA[LED IPS]]></screeninfo>
<screeninfo property="touchscreen"><![CDATA[Yes]]></screeninfo>
</monitor>
</screeninfos>
<gears>
<gear property="bag" type="laptop"><![CDATA[Yes]]></gear>
<gear property="charger" cells="8" W="240"><![CDATA[Yes]]></gear>
</gears>
<Informations>
<information type="price" unit="EUR"><![CDATA[2340]]></information>
<information type="rent price" unit="EUR/day"><![CDATA[50]]></information>
</Informations>
</Computer>
<!--Example of laptop: home-->
<Computer id ="2" type="laptop" purpose ="home">
<Generals>
<General property="color"><![CDATA[White]]></General>
<General property="release"><![CDATA[2015]]></General>
<General property="os" type ="64-bit"><![CDATA[Windows 8, Home]]></General>
<General property="manufactorer"><![CDATA[HP]]></General>
</Generals>
<Parameters>
<parameter property="battery" unit="h"><![CDATA[5,5]]></parameter>
<parameter property="weight" unit="kg"><![CDATA[1,68]]></parameter>
<parameter property="depth" unit ="cm"><![CDATA[24,4]]></parameter>
<parameter property="width" unit="cm"><![CDATA[34]]></parameter>
<parameter property="height" unit ="cm"><![CDATA[1,99]]></parameter>
</Parameters>
<components>
<component property="processor" type="i5" speed ="2,3-2,8Gz" manufactorer="Intel®"><![CDATA[Core™ 6200U]]></component>
<component property="videocard" type="DDR3" manufactorer="Intel®" serie="HD"><![CDATA[520]]></component>
<component property="storage" type="SSD" unit="GB"><![CDATA[128]]></component>
<component property="ram" type ="DDR3" unit="GB"><![CDATA[16]]></component>
</components>
<interfaces>
<inputs>
<input amount="2"><![CDATA[USB 3.0]]></input>
<input amount="1"><![CDATA[USB 2.0]]></input>
<input amount="1"><![CDATA[HDMI]]></input>
<input amount="1"><![CDATA[VGA]]></input>
<input amount="1"><![CDATA[Microphone]]></input>
</inputs>
<outputs>
<output amount="1"><![CDATA[Headset]]></output>
</outputs>
</interfaces>
<communications>
<communication type="Wifi"> <![CDATA[IEEE 802.11bc, IEEE 802.11gc, IEEE 802.11nc, IEEE 802.11a]]></communication>
<communication type="Bluetooth" version="4.0"><![CDATA[Bluetooth]]></communication>
</communications>
<screeninfos>
<monitor number="1">
<screeninfo property="resolution" type="HD"><![CDATA[1366x768]]></screeninfo>
<screeninfo property="size" unit="inch"><![CDATA[14]]></screeninfo>
<screeninfo property="surface"><![CDATA[matt]]></screeninfo>
<screeninfo property="screen type"><![CDATA[LED]]></screeninfo>
<screeninfo property="touchscreen"><![CDATA[No]]></screeninfo>
</monitor>
</screeninfos>
<gears>
<gear property="bag" type="laptop"><![CDATA[Yes]]></gear>
<gear property="charger" cells="4" W="45"><![CDATA[Yes]]></gear>
</gears>
<extras>
<extra><![CDATA[Id-card reader]]></extra>
<extra><![CDATA[CD-Drive]]></extra>
<extra type="Multi-in-1" supports="SD, SDHC, SDXC"><![CDATA[Memory-card reader]]></extra>
</extras>
<Informations>
<information type="price" unit="EUR"><![CDATA[720]]></information>
<information type="rent price" unit="EUR/day"><![CDATA[30]]></information>
</Informations>
</Computer>
<!--Example of laptop: office-->
<Computer id ="3" type="laptop" purpose ="office">
<Generals>
<General property="color"><![CDATA[Red]]></General>
<General property="release"><![CDATA[2015]]></General>
<General property="os" type ="64-bit"><![CDATA[Windows 8.1]]></General>
<General property="manufactorer"><![CDATA[Dell]]></General>
</Generals>
<Parameters>
<parameter property="battery" unit="h"><![CDATA[6,5]]></parameter>
<parameter property="weight" unit="kg"><![CDATA[2,11]]></parameter>
<parameter property="depth" unit ="cm"><![CDATA[29,12]]></parameter>
<parameter property="width" unit="cm"><![CDATA[37,78]]></parameter>
<parameter property="height" unit ="cm"><![CDATA[1,99]]></parameter>
</Parameters>
<components>
<component property="processor" type="i7" speed ="2,4-3,0Gz" manufactorer="Intel®"><![CDATA[Core™ 5500U]]></component>
<component property="videocard" type="GDDR5" manufactorer="AMD" serie="Radeon" vram="4096" vram_unit="MB"><![CDATA[R7 M270]]></component>
<component property="storage" type="SSD" unit="GB"><![CDATA[256]]></component>
<component property="ram" type ="DDR4" unit="GB"><![CDATA[16]]></component>
</components>
<interfaces>
<inputs>
<input amount="2"><![CDATA[USB 3.0]]></input>
<input amount="1"><![CDATA[USB 2.0]]></input>
<input amount="1"><![CDATA[HDMI]]></input>
<input amount="1"><![CDATA[Microphone]]></input>
</inputs>
<outputs>
<output amount="1"><![CDATA[Headset]]></output>
</outputs>
</interfaces>
<communications>
<communication type="Wifi"> <![CDATA[IEEE 802.11bc, IEEE 802.11gc, IEEE 802.11nc, IEEE 802.11a]]></communication>
<communication type="Bluetooth" version="4.0"><![CDATA[Bluetooth]]></communication>
</communications>
<screeninfos>
<monitor number="1">
<screeninfo property="resolution" type="UltraHD"><![CDATA[3840x2160]]></screeninfo>
<screeninfo property="size" unit="inch"><![CDATA[15,6]]></screeninfo>
<screeninfo property="surface"><![CDATA[shiny]]></screeninfo>
<screeninfo property="screen type"><![CDATA[LED IPS]]></screeninfo>
<screeninfo property="touchscreen"><![CDATA[No]]></screeninfo>
</monitor>
</screeninfos>
<gears>
<gear property="bag" type="laptop"><![CDATA[Yes]]></gear>
<gear property="charger" cells="4" W="65"><![CDATA[Yes]]></gear>
</gears>
<extras>
<extra><![CDATA[Id-card reader]]></extra>
<extra><![CDATA[CD-Drive]]></extra>
<extra type="Multi-in-1" supports="SD, SDHC, SDXC"><![CDATA[Memory-card reader]]></extra>
</extras>
<Informations>
<information type="price" unit="EUR"><![CDATA[1700]]></information>
<information type="rent price" unit="EUR/day"><![CDATA[40]]></information>
</Informations>
</Computer>
<!--Example of PC: gaming-->
<Computer id ="4" type="PC" purpose ="gaming">
<Generals>
<General property="color"><![CDATA[Black]]></General>
<General property="release"><![CDATA[2015]]></General>
<General property="os" type ="64-bit"><![CDATA[Windows 10, Home]]></General>
<General property="manufactorer"><![CDATA[AlienWare]]></General>
</Generals>
<Parameters>
<parameter property="weight" unit="kg"><![CDATA[3,6]]></parameter>
<parameter property="depth" unit ="cm"><![CDATA[20,32]]></parameter>
<parameter property="width" unit="cm"><![CDATA[20,32]]></parameter>
<parameter property="height" unit ="cm"><![CDATA[7,62]]></parameter>
</Parameters>
<components>
<component property="processor" type="i7" speed ="2,0-3,0Gz" manufactorer="Intel®"><![CDATA[Core™ 4765T]]></component>
<component property="videocard" type="GDDR5" manufactorer="NVIDIA®" serie="GeForce™" vram="3072" vram_unit="MB"><![CDATA[GTX 970M]]></component>
<component property="storage" type="SSD" unit="GB"><![CDATA[256]]></component>
<component property="storage" type="HDD" speed="7200 p/m" unit="TB"><![CDATA[1]]></component>
<component property="ram" type ="DDR4" unit="GB"><![CDATA[16]]></component>
</components>
<interfaces>
<inputs>
<input amount="4"><![CDATA[USB 3.0]]></input>
<input amount="2"><![CDATA[USB 2.0]]></input>
<input amount="1"><![CDATA[HDMI]]></input>
<input amount="1"><![CDATA[Mini-DP]]></input>
<input amount="1"><![CDATA[Microphone]]></input>
</inputs>
<outputs>
<output amount="1"><![CDATA[Headset]]></output>
</outputs>
</interfaces>
<communications>
<communication type="Wifi"> <![CDATA[IEEE 802.11bc, IEEE 802.11gc, IEEE 802.11nc, IEEE 802.11a]]></communication>
<communication type="Bluetooth" version="4.1"><![CDATA[Bluetooth]]></communication>
</communications>
<gears>
<gear property="cables"><![CDATA[Yes]]></gear>
</gears>
<extras>
<extra><![CDATA[Id-card reader]]></extra>
<extra><![CDATA[DVD-Drive]]></extra>
<extra type="Multi-in-1" supports="SD, SDHC, SDXC"><![CDATA[Memory-card reader]]></extra>
</extras>
<Informations>
<information type="price" unit="EUR"><![CDATA[2340]]></information>
<information type="rent price" unit="EUR/day"><![CDATA[75]]></information>
</Informations>
</Computer>
</Computers>
XML Validaator
static void Main(string[] args)
{
XmlSchemaSet schemas = new XmlSchemaSet();
//Change this line for your own place of the file
schemas.Add("", "C:/Users/Egert/Dropbox/programming/VISUALSPACE/arvutirent/WebApi.Arvutirent/XML_Data/Arvutirent.xsd");
Console.WriteLine("Attempting to validate");
//Change this line for your own place of the file
XDocument custOrdDoc = XDocument.Load("C:/Users/Egert/Dropbox/programming/VISUALSPACE/arvutirent/WebApi.Arvutirent/XML_Data/Arvutirent.xml");
bool errors = false;
custOrdDoc.Validate(schemas, (o, e) =>
{
Console.WriteLine("{0}", e.Message);
errors = true;
});
Console.WriteLine("custOrdDoc {0}", errors ? "did not validate" : "validated");
Console.WriteLine();
}
XSD Fail
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Computers">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Computer">
<xs:complexType>
<xs:sequence>
<xs:element name="Generals">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="General">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="property" type="xs:string" use="required" />
<xs:attribute name="type" type="xs:string" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Parameters">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="parameter">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="property" type="xs:string" use="required" />
<xs:attribute name="unit" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="components">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="component">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="property" type="xs:string" use="required" />
<xs:attribute name="type" type="xs:string" use="required" />
<xs:attribute name="speed" type="xs:string" use="optional" />
<xs:attribute name="manufactorer" type="xs:string" use="optional" />
<xs:attribute name="serie" type="xs:string" use="optional" />
<xs:attribute name="vram" type="xs:unsignedShort" use="optional" />
<xs:attribute name="vram_unit" type="xs:string" use="optional" />
<xs:attribute name="unit" type="xs:string" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="interfaces">
<xs:complexType>
<xs:sequence>
<xs:element name="inputs">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="input">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="amount" type="xs:unsignedByte" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="outputs">
<xs:complexType>
<xs:sequence>
<xs:element name="output">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="amount" type="xs:unsignedByte" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="communications">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="communication">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="type" type="xs:string" use="required" />
<xs:attribute name="version" type="xs:decimal" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="screeninfos">
<xs:complexType>
<xs:sequence>
<xs:element name="monitor">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="screeninfo">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="property" type="xs:string" use="required" />
<xs:attribute name="type" type="xs:string" use="optional" />
<xs:attribute name="unit" type="xs:string" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="number" type="xs:int" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="gears">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="gear">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="property" type="xs:string" use="required" />
<xs:attribute name="type" type="xs:string" use="optional" />
<xs:attribute name="cells" type="xs:unsignedByte" use="optional" />
<xs:attribute name="W" type="xs:unsignedByte" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="extras">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="extra">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="type" type="xs:string" use="optional" />
<xs:attribute name="supports" type="xs:string" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Informations">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="information">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="type" type="xs:string" use="required" />
<xs:attribute name="unit" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required" />
<xs:attribute name="type" type="xs:string" use="required" />
<xs:attribute name="purpose" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XLST: Näita kõiki arvuteid
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title>All Computers</title>
</head>
<body>
<h1> All computers in our project</h1>
<ul>
<xsl:for-each select="/Computers/Computer">
<!-- All computers-->
<li>
<h2><xsl:value-of select= "concat(@type, '.', @purpose, ' id:', @id )"/></h2>
General Info:
<ul>
<xsl:for-each select="Generals/General">
<li>
<xsl:value-of select="concat(@property, ': ', ., ' ',@type)"/>
</li>
</xsl:for-each>
</ul>
Parameters:
<ul>
<xsl:for-each select="Parameters/parameter">
<li>
<xsl:value-of select="concat(@property, ': ', ., @unit)"/>
</li>
</xsl:for-each>
</ul>
Components:
<ul>
<xsl:for-each select="components/component">
<li>
<xsl:if test="@property = 'processor'">
<xsl:value-of select="concat(@property, ': ', @manufactorer, ' ', @type, ' ', .,' ', @speed) "/>
</xsl:if>
<xsl:if test="@property = 'videocard'">
<xsl:value-of select="concat(@property, ': ', @manufactorer, ' ', @serie, ' ', .,' ', @type, ' ', @vram, @vram_unit) "/>
</xsl:if>
<xsl:if test="@property = 'storage' or @property = 'ram'">
<xsl:value-of select="concat(@property, ': ', ., @unit,' ', @type) "/>
</xsl:if>
</li>
</xsl:for-each>
</ul>
Interfaces:
<ul>
<xsl:for-each select="interfaces">
<li>
<b>INPUTS</b><br/>
<ul>
<xsl:for-each select="inputs/input">
<xsl:value-of select="concat(@amount,' x ',.)"/>
<br/>
</xsl:for-each>
</ul>
</li>
<li>
<b>OUTPUTS</b><br/>
<ul>
<xsl:for-each select="outputs/output">
<xsl:value-of select="concat(@amount,' x ', . )"/><br/>
</xsl:for-each>
</ul>
</li>
</xsl:for-each>
</ul>
Communications:
<ul>
<xsl:for-each select="communications/communication">
<li>
<xsl:value-of select="concat(@type, @version,': ', .)"/>
</li>
</xsl:for-each>
</ul>
<xsl:for-each select="screeninfos">
<xsl:choose>
<xsl:when test="monitor">
Screen Information:
<ul>
<xsl:for-each select="monitor">
<li>
<xsl:value-of select="concat('Monitor', @number)"/>
<br/>
<ul>
<xsl:for-each select="screeninfo">
<xsl:value-of select="concat(@property, ': ', . ,' ', @type, @unit)"/><br/>
</xsl:for-each>
</ul>
</li>
</xsl:for-each>
</ul>
</xsl:when>
</xsl:choose>
</xsl:for-each>
Gear Information:
<xsl:for-each select="gears">
<xsl:choose>
<xsl:when test="count(gear) > 0">
<ul>
<xsl:for-each select="gear">
<li>
<xsl:value-of select="@property"/>
<br/></li>
</xsl:for-each>
</ul>
</xsl:when>
<xsl:otherwise>
<ul>No Gear information available</ul>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
Informations:
<ul>
<xsl:for-each select="Informations/information">
<xsl:value-of select="concat(@type, ' ', ., ' ', @unit)"/><br/>
</xsl:for-each>
</ul>
</li>
<br/>
</xsl:for-each>
</ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XLST: Näita arvuteid millel on rohkem või täpselt kolm USB 3.0 porti
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title>All Computers</title>
</head>
<body>
<h1> Computers with 3 or more USB 3.0 ports</h1>
<ul>
<xsl:for-each select="/Computers/Computer">
<!-- All computers-->
<xsl:if test="@id = 1 or @id = 4">
<!--sellest v2ga rohkem neegrimaks ei l2he. Manuaalselt on ette antud, et millistel arvutitel on 3vRohkem USB 3.0 porti.
Kui mingi 100 arvutit on, siis see ei sobi. Kui uue arvuti projekti lisame, siis tuleks manuaalselt see ka siia lisada (juhul kui arvutil on 3vRohkem USB 3.0 porti).-->
<h2>
<xsl:value-of select= "concat(@type, '.', @purpose, ' id:', @id )"/>
</h2>
Interfaces:
<ul>
<xsl:for-each select="interfaces">
<li>
<b>INPUTS</b>
<br/>
<ul>
<xsl:for-each select="inputs/input">
<xsl:value-of select="concat(@amount,' x ',.)"/>
<br/>
</xsl:for-each>
</ul>
</li>
<li>
<b>OUTPUTS</b>
<br/>
<ul>
<xsl:for-each select="outputs/output">
<xsl:value-of select="concat(@amount,' x ', . )"/>
<br/>
</xsl:for-each>
</ul>
</li>
</xsl:for-each>
</ul>
General Info:
<ul>
<xsl:for-each select="Generals/General">
<li>
<xsl:value-of select="concat(@property, ': ', ., ' ',@type)"/>
</li>
</xsl:for-each>
</ul>
Parameters:
<ul>
<xsl:for-each select="Parameters/parameter">
<li>
<xsl:value-of select="concat(@property, ': ', ., @unit)"/>
</li>
</xsl:for-each>
</ul>
Components:
<ul>
<xsl:for-each select="components/component">
<li>
<xsl:if test="@property = 'processor'">
<xsl:value-of select="concat(@property, ': ', @manufactorer, ' ', @type, ' ', .,' ', @speed) "/>
</xsl:if>
<xsl:if test="@property = 'videocard'">
<xsl:value-of select="concat(@property, ': ', @manufactorer, ' ', @serie, ' ', .,' ', @type, ' ', @vram, @vram_unit) "/>
</xsl:if>
<xsl:if test="@property = 'storage' or @property = 'ram'">
<xsl:value-of select="concat(@property, ': ', ., @unit,' ', @type) "/>
</xsl:if>
</li>
</xsl:for-each>
</ul>
Communications:
<ul>
<xsl:for-each select="communications/communication">
<li>
<xsl:value-of select="concat(@type, @version,': ', .)"/>
</li>
</xsl:for-each>
</ul>
<xsl:for-each select="screeninfos">
<xsl:choose>
<xsl:when test="monitor">
Screen Information:
<ul>
<xsl:for-each select="monitor">
<li>
<xsl:value-of select="concat('Monitor', @number)"/>
<br/>
<ul>
<xsl:for-each select="screeninfo">
<xsl:value-of select="concat(@property, ': ', . ,' ', @type, @unit)"/>
<br/>
</xsl:for-each>
</ul>
</li>
</xsl:for-each>
</ul>
</xsl:when>
</xsl:choose>
</xsl:for-each>
Gear Information:
<xsl:for-each select="gears">
<xsl:choose>
<xsl:when test="count(gear) > 0">
<ul>
<xsl:for-each select="gear">
<li>
<xsl:value-of select="@property"/>
<br/>
</li>
</xsl:for-each>
</ul>
</xsl:when>
<xsl:otherwise>
<ul>No Gear information available</ul>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
Informations:
<ul>
<xsl:for-each select="Informations/information">
<xsl:value-of select="concat(@type, ' ', ., ' ', @unit)"/>
<br/>
</xsl:for-each>
</ul>
<br/>
</xsl:if>
</xsl:for-each>
</ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XLST: Näita arvuteid millel on i7 protsessor
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="html" indent="yes"/>
<xsl:template match="@* | node()">
<html>
<head>
<title>Computers with i7</title>
</head>
<body>
<h1>Computers with i7 processor</h1>
<xsl:for-each select="/Computers/Computer">
<xsl:variable name="compName" select="concat(@purpose, ' ', @type, ' id:', @id )"></xsl:variable>
<xsl:if test="components/component/@type='i7'">
<p>
<xsl:value-of select="$compName"/>
</p>
</xsl:if>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>