eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Resources
 ::   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 References  

Well we have pretty much let the cat out of the bag already. We have shown several examples of entity references above.

In short, Entity References refer to the key that unlocks an entity whch has been declared in an Entity Declaration. Entity References follow the simple syntax of:

&ENTITY_NAME;

such as

&letterhead;

WARNINGS:
  • Entities MUST be declared in an XML document before they are referenced.
  • Note that there may not be any whitespace embedded in an entity reference. In other words, & letterhead; or &letterhead ; will cause errors.
  • Though entities may refer to other entities, they may not be self-referential. So they may not reference other entities that reference them in return.
  • References to entities may not appear in the DOCTYPE declaration
  • The text that the entity references must be well-formed XML.

As you might expect parameter entity references work much like general entity references. In this case, we use a "%" sign instead of a "&".

%PARAMETER_ENTITY_NAME;

Now, you have already seen that entity references can take the place of regular character data and you have seen how useful that is. Before we leave the subject, I would only mention that you could also use entity references within tag attributes. For example, consider the following:

<INVOICE CLIENT = "&IBM;" PRODUCT = "&PRODUCT_ID_8762;" QUANTITY = "5">

WARNINGS:
  • You may not reference an external entity from within element attributes.
  • The referenced text may not contain the < character because it would cause a well-formed error in the element when replaced.

Previous Page | Next Page | Table of Contents