Download A framework for processing and presenting parallel text corpora
Transcript
40 Chapter 2 · A new markup scheme for text Listing 2.29: Changes to the base XTE DTD from listing 2.9 to make it “Schema compatible” (continued) %typeAttribute; CDATA #IMPLIED xmlns:typeNS CDATA #IMPLIED xmlns CDATA #IMPLIED > ... more element definitions ... <!ENTITY % default.attributes "start end CDATA #IMPLIED CDATA #IMPLIED ... more attribute definitions ... %typeAttribute; CDATA #IMPLIED xmlns:typeNS CDATA #IMPLIED xmlns CDATA #IMPLIED" > First of all we define entities for the namespace prefix of the http://www.w3.org/2001/XMLSche ma-instance namespace and entities for attributes from this namespace. For brevity we will use the default xsi: namespace prefix for this namespace in the following part of this section. The XTE root element is then extended by the xmlns:xsi attribute the content of which is preset to the fixed value http://www.w3.org/2001/XMLSchema-instance and the xsi:schemaLocation attribute which will hold the URL of the Schema against which the instance document should be validated. For the case where the user also wants to validate against an XML Schema which uses no target namespace, we additionally add the xsi:noNamespaceSchemaLocation attribute. The second change extends the attribute list of the body element and the default attributes defined in default.attributes with the xsi:type attribute. This is done in order to support the user customization of encodings through derivation as demonstrated in listing 2.24. Because all new encoding elements should use the attributes defined in the parameter entity default.attributes, they all are customizable by default. If the derived element is defined in its own namespace, a possibility is needed to make this namespace available before it can be referenced in the xsi:type attribute. This is exactly the function of the xmlns:typeNS attribute. It can be used to bind the typeNS: prefix to an arbitrary namespace which can then be referenced in the xsi:type attribute. Notice that the additional xsi:type and xmlns:typeNS attributes on the body element are only necessary if the XTE Schema is defined by means of derivation. The following listing shows how they would be used in an instance document validated by the custom encoding div1Body which is defined in the namespace http://www.language-explorer.org/XTE/div1. Listing 2.30: Usage of the xsi:type and xmlns:typeNS attributes. ... <xte:body encodingName="Default" type="default" view="native" xmlns:typeNS="http://www.language-explorer.org/XTE/div1" xsi:type="typeNS:div1Body"> <div1 xmlns="http://www.language-explorer.org/XTE/div1" link="1"> <p link="1"> <s start="0" end="44" link="1" style="title1" /> </p> ... Dissertation der Fak. f. Informations- u. Kognitionswissenschaften, Univ. Tübingen - 2004