Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Entity References

March 29, 1999

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 which 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.

The DOCTYPE Declarations
Introduction to XML For Web Developers | Table of Contents
Introduction to XML For Web Developers


Up to => Home / Authoring / Languages / XML / Tutorials / Intro




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers