Making Xlink work - a tough call ?

Heimo Hänninen <[email protected]> Thu, 11 Sep 2003 13:01:24 +0300
Newsgroups gmane.text.xml.hypertext
Message-ID <[email protected]>
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 ?? ).=20

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=20
Namespace declared attribute behaves like read-only - they are visible =
but
you cannot change values.=20
You can key text in attribute value box, but when pressing [enter] all
content disappears.=20
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=20
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=E4nninen
Technology Manager
e21 Solutions Oy=20
[email protected]=20

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

--------- Test file ---------
<?xml version=3D"1.0"?>
<infraryl:InfraRYL =
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"=20
                   xsi:schemaLocation=3D"http://www.rts.fi/infraryl
infraryl.xsd"=20
                   xmlns:infraryl=3D"http://www.rts.fi/infraryl"=20
                   xmlns:xlink=3D"http://www.w3.org/1999/xlink">
 <infraryl:Rakenne Pvm=3D"11092003" Tekija=3D"Heimo" Status=3D"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=3D"was entered in plain text
view">link</infraryl:Viite>
                  no luck so far...
        </infraryl:Kappale>
    </infraryl:Ohjeteksti>
  </infraryl:Rakenne>
 </infraryl:InfraRYL>