Presentation is loading. Please wait.

Presentation is loading. Please wait.

Session III Chapter 7 – Entities and Notation in DTD’s

Similar presentations


Presentation on theme: "Session III Chapter 7 – Entities and Notation in DTD’s"— Presentation transcript:

1 Session III Chapter 7 – Entities and Notation in DTD’s http://www.profburnett.com

2 Outline Introduction General Entities Creating Unparsed Content Embedding Unparsed Content Parameter Entities 8/1/2014Copyright © Carl M. Burnett2

3 Introduction Entities are used to define shortcuts to special characters. Entities can be two types: general and parameter General entities can be declared internal or external, parsed or unparsed Parameters can be declared internal or external, but are always parsed. 8/1/2014Copyright © Carl M. Burnett3

4 Creating & Using General Entities 8/1/2014Copyright © Carl M. Burnett4 1.Type <!ENTITY 2.Type ent_name where ent_name is name of the entity. 3.Type “ content” where content is the shortcut text. 4.Type > to close out the entity definition. Creating General Entities Using General Entities 1.Type in the XML document the “ &” 2.Type ent_name where ent_name is name of the entity. 3.Type a ; after the entity name.

5 Creating and Using External General Entities 8/1/2014Copyright © Carl M. Burnett5 Creating External General Entities Using External General Entities 1.Type <!ENTITY 2.Type ent_name where ent_name is name of the entity. 3.Type “ SYSTEM ” to indicate the entity is external. 4.Type “entity.uri” where the entity.uri file is located. 5.Type > to close out the entity definition. entity.ent file The first and most interesting fact about the gardens is that there is significant controversy about whether the gardens existed at all.... ancient historians have created one of the &wow;. 1.Add <standalone=“no” to the XML declaration. 2.Type & in the XML document where the ent_name is to be used. 3.Type ent_name where ent_name is name of the entity. 4.Type ; to close out the entity definition.... 600 226 earthquake &gardens_story;

6 Creating Unparsed Content 8/1/2014Copyright © Carl M. Burnett6 1.In the DTD where you want to embed the content type <!NOTATION_n_name where n_name is the content. 2.Type SYSTEM. 3.Type “notation.instr” where notation.instr is the URI for the unparsed content. 4.Type > to complete the notation. To Create a Notation To define an entity for the unparsed content 1.After the notation declaration type, <!ENTITY 2.Type ent_name where ent_name is the name for the external entity 3.Type SYSTEM. 4.Type “entity.uri” where entity.uri is the location of the file. 5.Type SNDATA n_name where n_name is the unparsed content name. 6.Type > to complete the definition.

7 Embedding Unparsed Content 8/1/2014Copyright © Carl M. Burnett7 1.In the DTD first define and declare an element. 2.Type <!ATTLIST tag where tag is the element you defined. 3.Type att_name where att_name is the name of the attribute. 4.Type ENTITY or ENTITIES to reference that this is an unparsed entity. 5.Type > to complete the attribute definition. To Declare the Attribute for the Unparsed Entity To Embed an Unparsed Entity into a XML Document 1.In the XML document that referes to the DTD add: standalone=“no” 2.In the body of the XML document within the attribute declared with an ENTITY type, att_name=“ent_name” where att_name is the name of the unparsed entity declared.

8 Creating and Using Parameter Entities 8/1/2014Copyright © Carl M. Burnett8 1.In the DTD type <!ENTITY to begin the definition. 2.Type % (space) to note that the entity is a parameter. 3.Type ent_name where ent_name is the name of the entity. 4.Type “content” where “content” is the shortcut text. 5.Type > to complete the entity definition. To Create a Parameter Entity To Use a Parameter Entity 1.In the DTD type % to begin the definition. 2.Then Type ent_name where ent_name is the name of the entity. 3.Finally type ; to close out the expression.

9 Creating an External Parameter Entity 8/1/2014Copyright © Carl M. Burnett9 1.Create the entity’s content in an external text file and save it with the extension.ent. To Create an External Parameter Entity To Define an External Parameter Entity 1.In the DTD type <!ENTITY to begin the entity definition. 2.Then type % to indicate that this is for a parameter entity. 3.Type ent_name where ent_name is the name of the entity. 4.Then type SYSTEM to indicate that the is defined externally. 5.Type “entity.uri” where “entity.uri” is the location of the external file with the content. 6.Finally type > to close out the entity definition. <!ATTLIST main_image file CDATA #REQUIRED w CDATA #REQUIRED h CDATA #REQUIRED> pic.ent file

10 Review Introduction General Entities Creating Unparsed Content Embedding Unparsed Content Parameter Entities 8/1/2014Copyright © Carl M. Burnett10 Next: Chapter 8 – Validation and Using DTDs


Download ppt "Session III Chapter 7 – Entities and Notation in DTD’s"

Similar presentations


Ads by Google