eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
 ::   Tutorials
 ::   Presentations
Perl & CGI tutorials
 ::   Intro to Perl/CGI and HTML Forms
 ::   Intro to Windows Perl
 ::   Intro to Perl 5
 ::   Intro to Perl
 ::   Intro to Perl Taint mode
 ::   Sherlock Holmes and the Case of the Broken CGI Script
 ::   Writing COM Components in Perl

Java tutorials
 ::   Intro to Java
 ::   Cross Browser Java

Misc technical tutorials
 ::   Intro to The Web Application Development Environment
 ::   Introduction to XML
 ::   Intro to Web Design
 ::   Intro to Web Security
 ::   Databases for Web Developers
 ::   UNIX for Web Developers
 ::   Intro to Adobe Photoshop
 ::   Web Programming 101
 ::   Introduction to Microsoft DNA

Misc non-technical tutorials
 ::   Misc Technopreneurship Docs
 ::   What is a Webmaster?
 ::   What is the open source business model?
 ::   Technical writing
 ::   Small and mid-sized businesses on the Web

Offsite tutorials
 ::   ISAPI Perl Primer
 ::   Serving up web server basics
 ::   Introduction to Java (Parts 1 and 2) in Slovak


Introduction to XML For Web Developers
Entity Declarations  

In the last section, we touched briefly upon the concept of entities. If you recall, both general and parameter entities were used like macros or aliases in XML.

Essentially, an entity allows you to create an alias to some large bit of text. Elsewhere in the document, you can refer to the large bit of text simply by referring to its alias. As you can imagine, this saves a lot for time that might otherwise be spent retyping the same text. It also means that modifications to data need only happen in one centralized locale to implement global changes.

General Entities  
General entities allow you to create document-wide entities and look something like:

    <!ENTITY % NAME "text that you want to be represented by the entity">

In the real world, you might have something that looked like the following:

    <!ENTITY % full_name "Diego Ramirez Valenzuela Martinez Perez the 5th">

Entities are referenced using a


such as


Make sure you remember the semi-colon. I forget this all the time :)

NOTE: You can specify an entity that has text defined external to the document by using the SYSTEM keyword such as:

    <!ENTITY % license_agreement
       SYSTEM "http://www.mydomain.com/license.xml">

In this case, the XML processor will replace the entity reference with the contents of the document specified.

Be careful that when defining entities, that you define them before using them. Thus, the following would be invalid because the TAG_NAMES alias is defined after it is used.

Parameter Entities  
Parameter entities, that can be either internal or external, are only used within the DTD and look something like the following:

      <!ENTITY % ALIAS "text to be aliased">

For example, you might have something like....

      <!ENTITY % NAME "text that you want to be represented">

Using Parameter entities, you can shorted the declarations of other elements and attributes such as:


NOTE: Parameter Entity declarations must precede any reference to them and must be properly nested.

Previous Page | Next Page | Table of Contents