1 / 13

ENG 5933 Humanities Computing

ENG 5933 Humanities Computing. Four: The DTD. <?xml version="1.0"?> <?xml-stylesheet href="jonson.xsl" type="text/xsl"?> <!DOCTYPE TEI.2 PUBLIC "-//TEI P4//DTD Main DTD Driver File//EN" "http://www.tei-c.org/Guidelines/DTD/tei2.dtd" [ <!ENTITY % TEI.XML 'INCLUDE'>

rianna
Download Presentation

ENG 5933 Humanities Computing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ENG 5933Humanities Computing Four: The DTD <?xml version="1.0"?> <?xml-stylesheet href="jonson.xsl" type="text/xsl"?> <!DOCTYPE TEI.2 PUBLIC "-//TEI P4//DTD Main DTD Driver File//EN" "http://www.tei-c.org/Guidelines/DTD/tei2.dtd" [ <!ENTITY % TEI.XML 'INCLUDE'> <!ENTITY % TEI.mixed 'INCLUDE'> <!ENTITY % TEI.drama 'INCLUDE'> <!ENTITY % TEI.verse 'INCLUDE'> <!ENTITY % TEI.prose 'INCLUDE'> <!ENTITY % TEI.figures 'INCLUDE'> <!ENTITY % TEI.linking 'INCLUDE'> <!ENTITY % TEI.transcr 'INCLUDE'> <!ENTITY % TEI.analysis 'INCLUDE'> <!ENTITY % TEI.textcrit 'INCLUDE'> <!ENTITY % ISOlat1 SYSTEM 'http://www.tei-c.org/Entity_Sets/Unicode/iso-lat1.ent'> %ISOlat1; <!ENTITY % ISOlat2 SYSTEM 'http://www.tei-c.org/Entity_Sets/Unicode/iso-lat2.ent'> %ISOlat2; <!ENTITY % ISOnum SYSTEM 'http://www.tei-c.org/Entity_Sets/Unicode/iso-num.ent'> %ISOnum; <!ENTITY % ISOpub SYSTEM 'http://www.tei-c.org/Entity_Sets/Unicode/iso-pub.ent'> %ISOpub; <!NOTATION jpg SYSTEM "IMAGES/JPEG"> <!ENTITY fig130-001-1 SYSTEM "fig130-001-1.jpg" NDATA jpg> ]>

  2. The XML Declaration The first line of any XML document contains the XML declaration: <?xml version=“1.0”?> If the file has an associated XSL stylesheet, it is declared next: <?xml-stylesheet href=“filename” type=“text/xsl”?> where “filename” is the URL of the associated stylesheet.

  3. Doctype Declaration The doctype declaration follows the XML declarations: <!DOCTYPE Root_element_name SYSTEM "Filename.dtd"> where “Filename.dtd” is the URL of the external dtd. Additions or references to the base dtd can be added between brackets “[ ]”: <!DOCTYPE Root_element_name SYSTEM "Filename.dtd”[ <!ENTITY %external.xml'INCLUDE'> <!ENTITYinternal“Ruffles”> <!ENTITY %charactersetSYSTEM ‘URL’> % characterset; ]>

  4. Doctype Declaration A dtd can also be included in the body of the document rather than in an external document: <!DOCTYPE Root_element_name SYSTEM [ Element, Attribute and, Entity Declarations... ]> where all the element, attribute, and entity declarations occur between the square brackets [ ].

  5. DTD Operators When declaring elements and attributes, use the following symbols to indicate relationships: ? Optional, 0 or 1 + Required, 1 or more * Optional and repeatable, 0 or more | Or , Sequential

  6. Element Declaration Element declarations take the following form: <!ELEMENTTagname (Content Model)> The Content Model may contain: * Specific tagnames or ANY (essentially any and all tagnames) * #PCDATA (essentially simple characters) * EMPTY (indicating an empty tag)

  7. Sample Element Declarations Simple text: <!ELEMENT formula (#PCDATA)> Mixed content: <!ELEMENT dateline (#PCDATA | date | time | name | address | anchor | gap | figure | index | interp | interpGrp | lb | milestone | pb)* > Complex: <!ELEMENT creatorInfo (creator,(creatorAddress|xref)*,(notes)?, (responsibleFor)*)> Empty: <!ELEMENT pb EMPTY >

  8. Attribute Declaration • Attribute declarations take the following form: • <!ATTLISTElement-name Attribute_name Type Default-value> • Attribute types can have the following values: • CDATA: Characters data that is not markup; • Enumerated: A list of values from which only one may be chosen; • ID: A unique name not shared by any other ID type in the document; • IDREF: The value of an ID type attribute of an element in the document; • IDREFS: Multiple IDS of elements separated by whitespace; • ENTITY: The name of an entity declared in the DTD; • ENTITIES: Names of multiple entitities declared in the DTD, separated by whitespace.

  9. Attribute Declaration • Attribute declarations take the following form: • <!ATTLISTElement-name Attribute_name Type Default-value> • Default types can have the following values: • #REQUIRED: The attribute must be included and given a value; • #IMPLIED: The attribute is optional • #FIXED: The attribute is required and the value is declared in the attribute declaration within quotes immediately after the default value declaration.

  10. Sample Attribute Declaration <!ATTLIST p corresp IDREFS #IMPLIED next IDREF #IMPLIED prev IDREF #IMPLIED ana IDREFS #IMPLIED id ID #IMPLIED n CDATA #IMPLIED lang IDREF #IMPLIED rend CDATA #IMPLIED TEIform CDATA "p" >

  11. Element & Attribute <!ELEMENT p (#PCDATA | ident | code | kw | abbr | address | date | name | num | rs | time | add | corr | del | orig | reg | sic | unclear | formula | emph | foreign | gloss | hi | mentioned | soCalled | term | title | ptr | ref | xptr | xref | s | seg | gi | eg | bibl | biblFull | cit | q | label | list | listBibl | note | stage | table | text | anchor | gap | figure | index | interp | interpGrp | lb | milestone | pb)* > <!ATTLIST p corresp IDREFS #IMPLIED next IDREF #IMPLIED prev IDREF #IMPLIED ana IDREFS #IMPLIED id ID #IMPLIED n CDATA #IMPLIED lang IDREF #IMPLIED rend CDATA #IMPLIED TEIform CDATA "p" >

  12. Element & Attribute <!ELEMENT div0 ((argument | byline | dateline | docAuthor | docDate | epigraph | head | opener | salute | signed | anchor | gap | figure | index | interp | interpGrp | lb | milestone | pb)*, (((div1 | divGen), (anchor | gap | figure | index | interp | interpGrp | lb | milestone | pb)*)+ | (((eg | bibl | biblFull | ab | l | lg | p | sp | cit | q | label | list | listBibl | note | stage | table), (anchor | gap | figure | index | interp | interpGrp | lb | milestone | pb)*)+, ((div1 | divGen), (anchor | gap | figure | index | interp | interpGrp | lb | milestone | pb)*)*)), ((byline | closer | dateline | epigraph | salute | signed | trailer), (anchor | gap | figure | index | interp | interpGrp | lb | milestone | pb)*)*) > <!ATTLIST div0 corresp IDREFS #IMPLIED next IDREF #IMPLIED prev IDREF #IMPLIED ana IDREFS #IMPLIED id ID #IMPLIED n CDATA #IMPLIED lang IDREF #IMPLIED rend CDATA #IMPLIED type CDATA #IMPLIED org (composite | uniform) "uniform" sample (initial | medial | final | unknown | complete) "complete" part (Y | N | I | M | F) "N" decls IDREFS #IMPLIED TEIform CDATA "div0" >

  13. Entity Declarations Document-level entity declarations take the following form: <!ENTITY Name "Replacement text"> Within a DTD, references to external parameter entities take the following form: <!ENTITY % Name "Replacement text URL"> % Name;

More Related