Minions: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Kkund (talk | contribs)
Kkund (talk | contribs)
No edit summary
Line 1: Line 1:
{| class="infobox" style="width: 30em; padding-left: 2em; float: right; font-size: 95%;"
|-//2014 koosseis
|colspan="2" style="background: black; text-align:center; color:white;" | '''Minions'''''
|-
| '''Õppeaine:'''
| Võrgurakendused II
|- style="vertical-align: top;"
| '''Meeskond:'''
|[[User:tmarkus|Tõnis Markus]] (Projektijuht)<br /> [[User:kkund|Kaspar Kund]]<br /> [[User:lkolkane|Lasse Kolkanen]]<br />
|- style="vertical-align: top;"
| '''Juhendaja:'''
|[[Mait Poska]]
|
|-}
== XML kodutöö ==
== XML kodutöö ==



Revision as of 11:04, 1 April 2014

XML kodutöö

Süsteemi unixi kasutajate loetelu koos servicitega


XML fail

<?xml version="1.0"?>
<kasutajad>
	<kasutaja id="0">
		<name>superroot</name>
		<services>
			<service id="0" option="0">
				<comment>Root-level user w/ most superior access</comment>
			</service>
			<service id="1" option="0">
				<comment>Premium subscription until end of service</comment>
			</service>
		</services>
	</kasutaja>
	<kasutaja id="1">
		<name>root</name>
		<services>
			<service id="0" option="0">
				<comment>Root-level user w/o premium service</comment>
			</service>
		</services>
	</kasutaja>
	<kasutaja id="2">
		<name>admin</name>
		<services>
			<service id="0" option="1">
				<comment>Admin-level user w/o premium service</comment>
			</service>
		</services>
	</kasutaja>
	<kasutaja id="3">
		<name>Kaspar</name>
		<services>
			<service id="0" option="1">
				<comment>Admin-level user</comment>
			</service>
			<service id="1" option="0">
				<comment>Premium subscription until end of service</comment>
			</service>
		</services>
	</kasutaja>
	<kasutaja id="4">
		<name>Tõnis</name>
		<services>
			<service id="0" option="0">
				<comment>Admin-level user</comment>
			</service>
			<service id="1" option="0">
				<comment>Premium subsciption until end of service</comment>
			</service>
		</services>
	</kasutaja>
	<kasutaja id="5">
		<name>Lasse</name>
		<services>
			<service id="0" option="1">
				<comment>Admin-level user</comment>
			</service>
			<service id="1" option="0">
				<comment>Premium subsciption until end of service</comment>
			</service>
		</services>
	</kasutaja>
	<kasutaja id="6">
		<name>mod</name>
		<services>
			<service id="0" option="2">
				<comment>Moderator-level user</comment>
			</service>
		</services>
	</kasutaja>
	<kasutaja id="7">
		<name>supermod</name>
		<services>
			<service id="0" option="2">
				<comment>Moderator-level user</comment>
			</service>
			<service id="1" option="0">
				<comment>Premium subsciption until end of service</comment>
			</service>
		</services>
	</kasutaja>
	<kasutaja id="8">
		<name>promod</name>
		<services>
			<service id="0" option="2">
				<comment>Moderator-level user</comment>
			</service>
			<service id="1" option="1" date="2015-02-01">
				<comment>Finite period premium user</comment>
			</service>
		</services>
	</kasutaja>
	<kasutaja id="9">
		<name>Pro User</name>
		<services>
			<service id="0" option="3">
				<comment>Consumer-level user</comment>
			</service>
			<service id="1" option="1" date="2015-01-01">
				<comment>Finite period premium user</comment>
			</service>
		</services>
	</kasutaja>
	<kasutaja id="10">
		<name>User</name>
		<services>
			<service id="0" option="3">
				<comment>Consumer-level user</comment>
			</service>
		</services>
	</kasutaja>
</kasutajad>

Skeemifail

<?xml version="1.0"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  attributeFormDefault="unqualified"
  elementFormDefault="qualified"
  targetNamespace="http://www.w3schools.com"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="kasutajad">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="kasutaja" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="name2" type="xs:token" minOccurs="1" maxOccurs="1"/>
              <xs:element name="services">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="service" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="comment" type="xs:string" minOccurs="0" maxOccurs="1"/>
                        </xs:sequence>
                        <xs:attribute name="id" type="xs:long" use="required"/>
                        <xs:attribute name="option" type="xs:integer" />
                        <xs:attribute name="date" type="xs:date" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="id" type="xs:long" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

1. XSL

<?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>Kasutajad</title>
        </head>
        <body>
          <ul>
            <xsl:for-each select="kasutajad/kasutaja">
            <li>
              <xsl:value-of select="name"/>
              <ul>
                <xsl:for-each select="services/service">
                  <li>
                    <xsl:value-of select="comment"/>
                  </li>
                </xsl:for-each>
              </ul>
            </li>
            </xsl:for-each>
          </ul>
        </body>
      </html>
    </xsl:template>
</xsl:stylesheet>

2. XSL

Minions
Õppeaine: Võrgurakendused II
Meeskond: Tõnis Markus (Projektijuht)
Kaspar Kund
Lasse Kolkanen
Juhendaja: Mait Poska