|
XML Home
XML Tutorial About XML XML Viewers XML Editors XML Documents XML Syntax XML Elements XML Attributes XML with CSS XML with XSL XML Namespace XML Local Namespace XML Default Namespace XML Entities XML Creating Entities XML CDATA DTDDTD IntroductionDTD DOCTYPE DTD Internal DTD External DTD Combined DTD FPI DTD Elements DTD Element Operators DTD Attributes DTD Attribute Default Values DTD Attribute Types DTD General Entities DTD Parameter Entities DTD Embedded Images XSLTXSLT IntroductionXSLT Example XSLT Syntax XSLT <template> XSLT <apply-templates> XSLT <value-of> XSLT <for-each> XSLT <sort> XSLT <if> XSLT <choose> XPathXPath IntroductionXPath Location Path XPath Location Path - Absolute XPath Location Path - Relative XPath Attributes XPath Axis XPath Node Test XPath Predicate XPath Node Set XPath Comparison Operators XPath Boolean Operators XPath Number Operators XPath String Functions Tutorial Summary XHTML Tutorial AJAX Tutorial FREE Hosting!With every domain name you register with ZappyHost, you get FREE hosting.$1.99 Domain NamesWith every new non-domain purchase thru ZappyHost, you get a domain name for only $1.99. |
XML Creating EntitiesIn the previous lesson, we learned what an entity is. We also saw the 5 predefined XML entities. In this lesson, we will learn how to create our own entities. To create your own entity, you simply define the entity in your DTD. Once you've defined the entity in your DTD, you are ready to use it within your XML document. Note: We will be covering DTDs later so don't be too concerned if you don't know what a DTD is yet. Defining Your EntityYou define your entity using the <!ENTITY> element using the following syntax:
Here, Using Your EntityWhenever you need to use your entity, you simply write the entity's name, surrounded by an ampersand (
ExampleImagine you have some text that you want to repeat at the bottom of all your documents. Let's say the text goes something like "Thank you, please come again!". Instead of typing all that text out every time you need to use it, you could create an entity called say, "footer". That way, you just need to include &footer; whenever you want to include that text. Now, if you ever need to change the text you only need to change it in one place - the definition.
Enjoy this website?
Oh, and thank you for supporting Quackit! |
Need Content for your Website?Get unique, quality digital content for your website. You can even earn money by reselling it!Includes:
|