Minions

From ICO wiki
Jump to navigationJump to search

XML kodutöö

Süsteemi unixi kasutajate loetelu koos servicitega


XML fail

<?xml version="1.0"?>
<kasutajad xmlns="http://www.w3schools.com/useradmin.xsd">
  <kasutaja id="0" name="Ülemboss">
    <username>superroot</username>
    <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>
    <contacts>
      <contact type="email">superroot@dev.null</contact>
      <contact type="phone">+372 543 210 00</contact>
    </contacts>
  </kasutaja>
  <kasutaja id="1" name="Juurkasutaja">
    <username>root</username>
    <services>
      <service id="0" option="0">
        <comment>Root-level user w/o premium service</comment>
      </service>
    </services>
    <contacts>
      <contact type="email">root@dev.null</contact>
      <contact type="phone">+372 543 210 01</contact>
    </contacts>
  </kasutaja>
  <kasutaja id="2" name="Administraator">
    <username>admin</username>
    <services>
      <service id="0" option="1">
        <comment>Admin-level user w/o premium service</comment>
      </service>
    </services>
    <contacts>
      <contact type="email">admin@dev.null</contact>
      <contact type="phone">+372 543 210 02</contact>
    </contacts>
  </kasutaja>
  <kasutaja id="3" name="Kaspar Kund">
    <username>kaspar</username>
    <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>
    <contacts>
      <contact type="email">kaspar.kund@itcollege.ee</contact>
      <contact type="phone">+372 543 210 03</contact>
    </contacts>
  </kasutaja>
  <kasutaja id="4" name="Tõnis Markus">
    <username>tonis</username>
    <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>
    <contacts>
      <contact type="email">tonis.markus@itcollege.ee</contact>
      <contact type="phone">+372 543 210 04</contact>
    </contacts>
  </kasutaja>
  <kasutaja id="5" name="Lasse Kolkanen">
    <username>lasse</username>
    <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>
    <contacts>
      <contact type="email">lasse.kolkanen@itcollege.ee</contact>
      <contact type="phone">+372 543 210 05</contact>
    </contacts>
  </kasutaja>
  <kasutaja id="6" name="Moderaator">
    <username>mod</username>
    <services>
      <service id="0" option="2">
        <comment>Moderator-level user</comment>
      </service>
    </services>
    <contacts>
      <contact type="email">mod@dev.null</contact>
      <contact type="phone">+372 543 210 06</contact>
    </contacts>
  </kasutaja>
  <kasutaja id="7" name="Peamoderaator">
    <username>supermod</username>
    <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>
    <contacts>
      <contact type="email">supermod@dev.null</contact>
      <contact type="phone">+372 543 210 07</contact>
    </contacts>
  </kasutaja>
  <kasutaja id="8" name="Pro moderaator">
    <username>promod</username>
    <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>
    <contacts>
      <contact type="email">promod@dev.null</contact>
      <contact type="phone">+372 543 210 08</contact>
    </contacts>
  </kasutaja>
  <kasutaja id="9" name="Pro kasutaja">
    <username>prouser</username>
    <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>
    <contacts>
      <contact type="email">promod@dev.null</contact>
      <contact type="phone">+372 543 210 09</contact>
    </contacts>
  </kasutaja>
  <kasutaja id="10" name="Kasutaja">
    <username>user</username>
    <services>
      <service id="0" option="3">
        <comment>Consumer-level user</comment>
      </service>
    </services>
    <contacts>
      <contact type="email">user@dev.null</contact>
      <contact type="phone">+372 543 210 10</contact>
    </contacts>
  </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/useradmin.xsd"
  xmlns:this="http://www.w3schools.com/useradmin.xsd"
  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="username" 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:element name="contacts" minOccurs="0">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="contact">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute name="type" use="required" >
                              <xs:simpleType>
                                <xs:restriction base="xs:string">
                                  <xs:enumeration value="email"/>
                                  <xs:enumeration value="phone"/>
                                  <xs:enumeration value="skype"/>
                                  <xs:enumeration value="mobile"/>
                                  <xs:enumeration value="website"/>
                                </xs:restriction>
                              </xs:simpleType>
                            </xs:attribute>
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="id" type="xs:long" use="required" />
            <xs:attribute name="name" type="xs:string"/>
          </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