Minions: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Kkund (talk | contribs)
No edit summary
Lkolkane (talk | contribs)
Line 23: Line 23:
<pre>
<pre>
<?xml version="1.0"?>
<?xml version="1.0"?>
<kasutajad>
<kasutajad xmlns="http://www.w3schools.com/useradmin.xsd">
<kasutaja id="0">
  <kasutaja id="0" name="Ülemboss">
<name>superroot</name>
    <username>superroot</username>
<services>
    <services>
<service id="0" option="0">
      <service id="0" option="0">
<comment>Root-level user w/ most superior access</comment>
        <comment>Root-level user w/ most superior access</comment>
</service>
      </service>
<service id="1" option="0">
      <service id="1" option="0">
<comment>Premium subscription until end of service</comment>
        <comment>Premium subscription until end of service</comment>
</service>
      </service>
</services>
    </services>
</kasutaja>
    <contacts>
<kasutaja id="1">
      <contact type="email">superroot@dev.null</contact>
<name>root</name>
      <contact type="phone">+372 543 210 00</contact>
<services>
    </contacts>
<service id="0" option="0">
  </kasutaja>
<comment>Root-level user w/o premium service</comment>
  <kasutaja id="1" name="Juurkasutaja">
</service>
    <username>root</username>
</services>
    <services>
</kasutaja>
      <service id="0" option="0">
<kasutaja id="2">
        <comment>Root-level user w/o premium service</comment>
<name>admin</name>
      </service>
<services>
    </services>
<service id="0" option="1">
    <contacts>
<comment>Admin-level user w/o premium service</comment>
      <contact type="email">root@dev.null</contact>
</service>
      <contact type="phone">+372 543 210 01</contact>
</services>
    </contacts>
</kasutaja>
  </kasutaja>
<kasutaja id="3">
  <kasutaja id="2" name="Administraator">
<name>Kaspar</name>
    <username>admin</username>
<services>
    <services>
<service id="0" option="1">
      <service id="0" option="1">
<comment>Admin-level user</comment>
        <comment>Admin-level user w/o premium service</comment>
</service>
      </service>
<service id="1" option="0">
    </services>
<comment>Premium subscription until end of service</comment>
    <contacts>
</service>
      <contact type="email">admin@dev.null</contact>
</services>
      <contact type="phone">+372 543 210 02</contact>
</kasutaja>
    </contacts>
<kasutaja id="4">
  </kasutaja>
<name>Tõnis</name>
  <kasutaja id="3" name="Kaspar Kund">
<services>
    <username>kaspar</username>
<service id="0" option="0">
    <services>
<comment>Admin-level user</comment>
      <service id="0" option="1">
</service>
        <comment>Admin-level user</comment>
<service id="1" option="0">
      </service>
<comment>Premium subsciption until end of service</comment>
      <service id="1" option="0">
</service>
        <comment>Premium subscription until end of service</comment>
</services>
      </service>
</kasutaja>
    </services>
<kasutaja id="5">
    <contacts>
<name>Lasse</name>
      <contact type="email">kaspar.kund@itcollege.ee</contact>
<services>
      <contact type="phone">+372 543 210 03</contact>
<service id="0" option="1">
    </contacts>
<comment>Admin-level user</comment>
  </kasutaja>
</service>
  <kasutaja id="4" name="Tõnis Markus">
<service id="1" option="0">
    <username>tonis</username>
<comment>Premium subsciption until end of service</comment>
    <services>
</service>
      <service id="0" option="0">
</services>
        <comment>Admin-level user</comment>
</kasutaja>
      </service>
<kasutaja id="6">
      <service id="1" option="0">
<name>mod</name>
        <comment>Premium subsciption until end of service</comment>
<services>
      </service>
<service id="0" option="2">
    </services>
<comment>Moderator-level user</comment>
    <contacts>
</service>
      <contact type="email">tonis.markus@itcollege.ee</contact>
</services>
      <contact type="phone">+372 543 210 04</contact>
</kasutaja>
    </contacts>
<kasutaja id="7">
  </kasutaja>
<name>supermod</name>
  <kasutaja id="5" name="Lasse Kolkanen">
<services>
    <username>lasse</username>
<service id="0" option="2">
    <services>
<comment>Moderator-level user</comment>
      <service id="0" option="1">
</service>
        <comment>Admin-level user</comment>
<service id="1" option="0">
      </service>
<comment>Premium subsciption until end of service</comment>
      <service id="1" option="0">
</service>
        <comment>Premium subsciption until end of service</comment>
</services>
      </service>
</kasutaja>
    </services>
<kasutaja id="8">
    <contacts>
<name>promod</name>
      <contact type="email">lasse.kolkanen@itcollege.ee</contact>
<services>
      <contact type="phone">+372 543 210 05</contact>
<service id="0" option="2">
    </contacts>
<comment>Moderator-level user</comment>
  </kasutaja>
</service>
  <kasutaja id="6" name="Moderaator">
<service id="1" option="1" date="2015-02-01">
    <username>mod</username>
<comment>Finite period premium user</comment>
    <services>
</service>
      <service id="0" option="2">
</services>
        <comment>Moderator-level user</comment>
</kasutaja>
      </service>
<kasutaja id="9">
    </services>
<name>Pro User</name>
    <contacts>
<services>
      <contact type="email">mod@dev.null</contact>
<service id="0" option="3">
      <contact type="phone">+372 543 210 06</contact>
<comment>Consumer-level user</comment>
    </contacts>
</service>
  </kasutaja>
<service id="1" option="1" date="2015-01-01">
  <kasutaja id="7" name="Peamoderaator">
<comment>Finite period premium user</comment>
    <username>supermod</username>
</service>
    <services>
</services>
      <service id="0" option="2">
</kasutaja>
        <comment>Moderator-level user</comment>
<kasutaja id="10">
      </service>
<name>User</name>
      <service id="1" option="0">
<services>
        <comment>Premium subsciption until end of service</comment>
<service id="0" option="3">
      </service>
<comment>Consumer-level user</comment>
    </services>
</service>
    <contacts>
</services>
      <contact type="email">supermod@dev.null</contact>
</kasutaja>
      <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>
</kasutajad>
</pre>
</pre>

Revision as of 11:21, 3 May 2014

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"
  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