XML-LINK

Peter Murray-Rust Peter at ursus.demon.co.uk
Sun Mar 30 18:39:31 BST 1997


I am trying to think about how to (a) write and (b) process documents that
use the XML-LINK syntax.  (For those who aren't up-to-date with the WG's 
discussions, LINK is being discussed at this moment.  Some parts of it
seem to have coalesced (i.e. not much visible discussion) and I'd like some
clarification on some points in the draft - I didn't manage to understand all
the discussion.)  I am not seeking to re-open things which have been decided,
but rather to know how it should be used.  I realise that some of the
discussion postdates the doc I am working from: (WD-xml-link-970305) at:
http://www.textuality.com/sgml-erb/WD-xml-link.html.

I'd be very grateful for comments on the following - I'll refer to sections.
These are my understandings - please correct them :-)

2.1  The preferred mechanism is to have multiple attributes for elements which
carry the XML-LINK attribute.  This is currently illegal in SGML, although 
this is likely to change and XML is rather hoping this will be soon.  So a
DTD might have an A element (similar to HTML):

<!ELEMENT A (#PCDATA|IMG|MYTAG)*>
<!ATTLIST A 
        COLOUR CDATA "BLUE>
and later
<!ATTLIST A XML-LINK CDATA #FIXED "LINK">

To get round the illegality it would be allowed (though messy) to combine
these into a single ATTLIST.

***If SGML is not revised, the *parser* would have to process multiple
attlists***.  The documents before parsing would not be valid SGML.

For a well-formed document the link attributes may have to be inserted
in the document.  No changes are necessary for the parser.

NOTE:  If XML-LINK is added from the DTD, all XML-LINK values are identical
("#FIXED"). If they are added within the document, the *could* have different
values and the parser would not complain, but this seems to break the spirit
of the draft.  If ATTLIST A XML-LINK is provided in the DTD, then any 
attributes in the document must be #FIXED (?), and so are redundant.  If they
do not agree it's an error (even in a WF document?).

Table 3.2 I have difficulty in understanding this, especially the very similar
terms LINK, XML-LINK, XLINK and XML-XLINK.  My understanding is this:

The table does not (although it appears to) define an XML-XLINK element.  My
understanding is that 'XML-XLINK' is a generic variable replaceable by 'FOO'
or whatver for as many elements as the DTD author requires.  So in the above
example, 'XML-LINK' would be replaced by 'A'.  (I assume the same for 
XML-LOCATOR, XML-LINK, XLG and XLD).  (The five tables in 3.2, 3.3, 6.1 
correspond to the five allowed values of XLINK, which must be #FIXED for each).

There is a different number of attributes for each of the five types (given 
in the tables).  If an attribute occurs in more than one of the five it always
has the same form apart from XML-LINK.

Elements with the attribute XML-LINK="XLINK" have a content model which
can only include #PCDATA or 'XML-LOCATOR'.  Since 'XML-LOCATOR' is determined
by its XML-LINK attribute value and not by its GI a normal SGML parser cannot
detect this.  [A similar argument holds for elements with XML-LINK="XLG"].

***The *?parser?* will have to determine whether elements with attribute
XML-LINK="XLINK" contain only elements with attribute XML-LINK="LOCATOR"
(or #PCDATA).  This presumably has to hold for well-formed documents without
an internal DTD, but with explicit attribute values.  Or does the parser
simply look for well formedness and leave this slightly hairy problem to
the application/link_processor?***

If no ENTITY is defined for FOO, and <FOO XML-LINK="LINK" ...> appears
in the document, what happens?  Is the parser or application required to 
detect this as a reserved attribute ***and fill in all the others in the draft
for that XML-LINK type?***

So, assuming this is on the right lines, there are three uses of XML-LINK:
(a)LINK by itself
(b)XLINK/LOCATOR working together
(c)XLG/XLD working together.

I presume the syntax looks something like:

(a) (Assume element A as above):
<P>This is the <A XML-LINK="LINK" COLOUR="RED">Home of the <IMG SRC="zoo.gif"/>
Elephant house</A> and the <IMG SRC="monkey.gif/></P>
Is there anything else that needs to be considered?

(b) 
<!ENTITY % XLINK-attribs '
                XML-LINK               CDATA   #FIXED  "XLINK"
                ROLE                   CDATA   #IMPLIED
                etc. as in 3.2
                ACTUATE            (AUTO|USER) "USER"                
                '>

and similarly for %LOCATOR-attribs 

<!ELEMENT ZOO (#PCDATA|MONKEY|ELEPHANT)*>
<!ATTLIST ZOO COUNTRY CDATA #IMPLIED>
<!ATTLIST ZOO %XLINK-attribs>

<!ELEMENT MONKEY EMPTY>
<!ELEMENT ELEPHANT EMPTY>
<!ATTLIST MONKEY COUNT CDATA #IMPLIED>
<!ATTLIST ELEPHANT COLOUR CDATA #IMPLIED>
<!ATTLIST MONKEY %LOCATOR-attribs>
<!ATTLIST ELEPHANT %LOCATOR-attribs>

in the document:

<P>In the <ZOO COUNTRY="EN" SHOW="INCLUDE" ACTUATE="AUTO"> we can find 
<ELEPHANT COLOUR="PINK" TITLE="NELLIE" HREF="nellie.gif" SHOW="INCLUDE"
ACTUATE="AUTO"/>
and <ELEPHANT TITLE="JUMBO" COLOUR="BLUE" ACTUATE="USER" SHOW="NEW"
HRTYPE="URL" HREF="http://www.venus.co.uk/omf/cml/jumbo.class"
BEHAVIOUR="application/java"/>
and some monkeys 
<MONKEY ACTUATE="USER" COUNT="500" SHOW="INCLUDE" HREF="monkeys.au"/>
<ZOO> tomorrow</P>

If I am anywhere near right, this means that:
The text (#PCDATA) will be displayed along with an image of Nellie and a button
(application-defined) to JUMBO and the monkeys.  When JUMBO-button is pressed,
then an additinal window (the Jumbo browser?) is launched.  When the monkey
buton is pressed the current window disappears to be replaced by gibbering.
Presumably the application decides whether the Jumbo browser is killed at
this stage.

[I am not clear what the SHOW/ACTUATE, etc. do for the XML-XLINK container.
Presumably the contents could be hidden until a button was pressed?  In the 
example, the whole contents of ZOO would be INCLUDEd in the Paragraph?]

(c) is a list of documents and presumably straightforward?



It would be useful to have comments and other examples for XML-LINK as it may
impact on XML-LANG.  For example, a DTD should not be designed with attributes
such as ROLE, TITLE, SHOW if it is likely to be used for XML-LINK at a later
stage - perhaps this should appear in the draft?

	P.

-- 
Peter Murray-Rust, domestic net connection
Virtual School of Molecular Sciences
http://www.vsms.nottingham.ac.uk/

xml-dev: A list for W3C XML Developers
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To unsubscribe, send to majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa at ic.ac.uk)




More information about the Xml-dev mailing list