[xml-h] Making Xlink work - a tough call ?

Heimo Hänninen heimo.hanninen at e21online.com
Thu Sep 11 14:01:24 BST 2003


Hello

I'm developing a schema for a client and decided to implement Xlink. Not
much experience with Xlink but learning.
Importing namespace xlink module to the main schema digested ( btw, it seems
to me that only way to use several namespaces in the schema is to import
them as files, i.e.. you cannot have different namespace objects in a single
schema file, right ?? ). 

The actual problem is that schema seems not to work ok in Xmetal 4.0, chosen
as authoring tool.
Schema is developed and validated in XMLSpy and behaves ok. In Xmetal it
validates ok as well, but any 
Namespace declared attribute behaves like read-only - they are visible but
you cannot change values. 
You can key text in attribute value box, but when pressing [enter] all
content disappears. 
Only way to enter data into attributes is by using "plain text view".

Before I start debugging Xmetal, which I think is a very decent tool, could
somebody advice me that 
my included schemas really are ok  (tag names are in Finnish, customer's
choice):
-namespace stuff declared ok
-xlink deploying element <Viite> ok
-xlink module ok

Thanks for you patience, hope answers will enlighten others planning to
implement xlink
Heimo Hänninen
Technology Manager
e21 Solutions Oy 
heimo.hanninen at e21online.com 

------ main schema (heavily simplified), importing xlink -----
<?xml version="1.0" encoding="UTF-8"?>
<!--InfraRYL W3C Schema limited test version, for more information contact:
heimohanninen at yahoo.co.uk-->
<xsd:schema targetNamespace="http://www.rts.fi/infraryl" 
xmlns:xlink="http://www.w3.org/1999/xlink" 
xmlns="http://www.rts.fi/infraryl" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
version="1.0">
    <!-- W3C Xlink definitions are imported from module xlink-rati.xsd -->
    <xsd:import namespace="http://www.w3.org/1999/xlink"
schemaLocation="xlink.xsd"/>
    <xsd:complexType name="KappaleMixType"
id="infraryl.global.leipaelementit" mixed="true">
        <xsd:choice minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="Lihava" type="KappaleMixType"/>
            <xsd:element name="Viite" type="ViiteType"/>
        </xsd:choice>
    </xsd:complexType>
    <xsd:complexType name="BodyMixType" id="infraryl.global.kappaleteksti">
        <xsd:choice minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="Kappale" type="KappaleMixType"/>
        </xsd:choice>
    </xsd:complexType>
    <xsd:element name="Ohjeteksti" type="BodyMixType"
id="infraryl.global.ohjeteksti">
    </xsd:element>
    <xsd:element name="InfraRYL">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="Rakenne" type="RakenneType"
maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="Tunniste" type="xsd:ID" use="optional"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:complexType name="NimikeType">
        <xsd:sequence>
            <xsd:element ref="Tunniste"/>
            <xsd:element ref="Otsikko"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="Otsikko" type="xsd:string"/>
    <xsd:complexType name="RakenneType">
        <xsd:sequence>
            <xsd:element ref="Nimike"/>
            <xsd:choice minOccurs="0" maxOccurs="unbounded">
                <xsd:element ref="Ohjeteksti"/>
            </xsd:choice>
        </xsd:sequence>
        <xsd:attribute name="Pvm" type="xsd:string" use="required"/>
        <xsd:attribute name="Tekija" type="xsd:string" use="required"/>
        <xsd:attribute name="Status" type="xsd:string" use="required"/>
    </xsd:complexType>
    <xsd:element name="Tunniste">
        <xsd:simpleType>
            <xsd:restriction base="xsd:ID"/>
        </xsd:simpleType>
    </xsd:element>
    <xsd:complexType name="ViiteType" mixed="true">
        <xsd:choice minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="Lihava" type="KappaleMixType"/>
            <xsd:element name="Viite">
                <xsd:complexType>
                    <xsd:complexContent>
                        <xsd:extension base="ViiteType"/>
                    </xsd:complexContent>
                </xsd:complexType>
            </xsd:element>
        </xsd:choice>
        <xsd:attribute ref="xlink:href" use="optional"/>
        <xsd:attribute ref="xlink:show" use="optional"/>
        <xsd:attribute ref="xlink:type" use="required" fixed="simple"/>
        <xsd:attribute ref="xlink:role" use="optional"/>
        <xsd:attribute ref="xlink:title" use="optional"/>
        <xsd:attribute ref="xlink:actuate" use="optional"/>
        <xsd:attribute ref="xlink:arcrole" use="optional"/>
    </xsd:complexType>
    <xsd:element name="Nimike" type="NimikeType"/>
</xsd:schema>
--------------- Xlink module: ---------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- xlink module -->
<xsd:schema targetNamespace="http://www.w3.org/1999/xlink" 
xmlns="http://www.w3.org/1999/xlink"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" attributeFormDefault="qualified">
    <xsd:attribute name="type">
        <xsd:simpleType>
            <xsd:restriction base="xsd:NMTOKEN">
                <xsd:enumeration value="simple"/>
                <xsd:enumeration value="extended"/>
                <xsd:enumeration value="locator"/>
                <xsd:enumeration value="arc"/>
                <xsd:enumeration value="resource"/>
                <xsd:enumeration value="title"/>
                <xsd:enumeration value="none"/>
            </xsd:restriction>
        </xsd:simpleType>
    </xsd:attribute>
    <xsd:attribute name="href" type="xsd:anyURI">
    </xsd:attribute>
    <xsd:attribute name="role" type="xsd:anyURI">
    </xsd:attribute>
    <xsd:attribute name="arcrole">
        <xsd:simpleType>
            <xsd:restriction base="xsd:NMTOKEN">
                <xsd:enumeration value="URL"/>
                <xsd:enumeration value="STD"/>
                <xsd:enumeration value="otherValid"/>
                <xsd:enumeration value="RatiValid"/>
            </xsd:restriction>
        </xsd:simpleType>
    </xsd:attribute>
    <xsd:attribute name="title" type="xsd:string">
    </xsd:attribute>
    <xsd:attribute name="show">
        <xsd:simpleType>
            <xsd:restriction base="xsd:NMTOKEN">
                <xsd:enumeration value="new"/>
                <xsd:enumeration value="replace"/>
                <xsd:enumeration value="embed"/>
                <xsd:enumeration value="other"/>
                <xsd:enumeration value="none"/>
            </xsd:restriction>
        </xsd:simpleType>
    </xsd:attribute>
    <xsd:attribute name="actuate">
        <xsd:simpleType>
            <xsd:restriction base="xsd:NMTOKEN">
                <xsd:enumeration value="onLoad"/>
                <xsd:enumeration value="onRequest"/>
                <xsd:enumeration value="other"/>
                <xsd:enumeration value="none"/>
            </xsd:restriction>
        </xsd:simpleType>
    </xsd:attribute>
</xsd:schema>

--------- Test file ---------
<?xml version="1.0"?>
<infraryl:InfraRYL xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                   xsi:schemaLocation="http://www.rts.fi/infraryl
infraryl.xsd" 
                   xmlns:infraryl="http://www.rts.fi/infraryl" 
                   xmlns:xlink="http://www.w3.org/1999/xlink">
 <infraryl:Rakenne Pvm="11092003" Tekija="Heimo" Status="test">
    <infraryl:Nimike><infraryl:Tunniste>t1</infraryl:Tunniste>
        <infraryl:Otsikko>test in Xmetal</infraryl:Otsikko>
    </infraryl:Nimike>
    <infraryl:Ohjeteksti>
        <infraryl:Kappale>here is a sample link element called
                    Viite, go and try to edit any xlink:attributes in
&lt;Viite&gt; element:
        <infraryl:Viite xlink:title="was entered in plain text
view">link</infraryl:Viite>
                  no luck so far...
        </infraryl:Kappale>
    </infraryl:Ohjeteksti>
  </infraryl:Rakenne>
 </infraryl:InfraRYL>





More information about the xml-hypertext mailing list