The Significance of Notations


Unparsed entities are unable to be processed by XML applications, which means that applications have no way of knowing what to do with them unless you specify helper information that allows an application to rely on a helper application to process the entity. The helper application could be a browser plug-in or a standalone application that has been installed on a user's computer. Either way, the idea is that a notation directs an XML application to a helper application so that unparsed entities can be handled in a meaningful manner. The most obvious example of this type of handling is an external binary image entity, which could be processed and displayed by an image viewer (the helper application).

Notations are used to specify helper information for an unparsed entity and are required of all unparsed entities. Following is an example of a notation that describes the JPEG image type:

<!NOTATION JPEG SYSTEM "image/jpeg">

In this example, the name of the notation is JPEG, and the helper information is image/jpeg, which is a universal type that identifies the JPEG image format. It is expected that an XML application could somehow use this helper information to query the system for the JPEG type in order to figure out how to view JPEG images. So, this information would come into play when an XML application encounters the following image entity:

<!ENTITY pond SYSTEM "pond.jpg" NDATA JPEG>

If you didn't want to trust the XML application to figure out how to view the image on its own, you can get more specific with notations and specify an application, as follows:

<!NOTATION JPEG SYSTEM "Picasa2.exe">

This code associates Google's popular Picasa image editing application (Picasa2.exe) with JPEG images so that an XML application can use it to view JPEG images. Following is an example of what a complete XML document looks like that contains a single image as an unparsed entity:

<?xml version="1.0" standalone="no"?> <!DOCTYPE image [ <!NOTATION JPEG SYSTEM "Picasa2.exe "> <!ENTITY pond SYSTEM "pond.jpg" NDATA JPEG> <!ELEMENT image EMPTY> <!ATTLIST image source ENTITY #REQUIRED> ]> <image source="skate" />

Although this code does all the right things in terms of providing the information necessary to process and display a JPEG image, it still doesn't work in major web browsers because none of them support unparsed entities. In truth, web browsers know that the entities are unparsed; they just don't know what to do with them. Hopefully this will be remedied at some point in the future. Keep in mind, however, that although web browsers may not support unparsed entities, plenty of other XML applications and tools do support them.




Sams Teach Yourself XML in 24 Hours
Sams Teach Yourself XML in 24 Hours, Complete Starter Kit (3rd Edition)
ISBN: 067232797X
EAN: 2147483647
Year: 2005
Pages: 266

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net