| Previous | Next
DTDs for XLinksFor a document that contains XLinks to be valid, all the XLink attributes that the document uses have to be declared in a DTD just like any other attributes. In most cases some of the attributes can be declared <!ELEMENT novel (title, author, year)> <!ATTLIST novel xmlns:xlink CDATA #FIXED 'http://www.w3.org/1999/xlink' xlink:type (simple) #FIXED 'simple' xlink:href CDATA #REQUIRED> <!ELEMENT title (#PCDATA)> <!ELEMENT author (#PCDATA)> <!ELEMENT year (#PCDATA)> Given this DTD to fill in the fixed attributes <novel xlink:href = "urn:"> <title>The Wonderful Wizard of Oz</title> <author>L. Frank Baum</author> <year>1900</year> </novel> Documents that contain many XLink elements often use parameter entity references to define the common attributes. For example, suppose <!ENTITY % simplelink "xlink:type (simple) #FIXED 'simple' xlink:href CDATA #REQUIRED xmlns:xlink CDATA #FIXED 'http://www.w3.org/1999/xlink' xlink:role CDATA #IMPLIED xlink:title CDATA #IMPLIED xlink:actuate (onRequest | onLoad | other | none) 'onRequest' xlink:show (new | replace | embed | other | none) 'new'" > <!ATTLIST anthology %simplelink;> <!ATTLIST novel %simplelink;> <!ATTLIST nonfiction %simplelink;> Similar techniques can be applied to declarations of attributes for extended XLinks. |