Luis Abreu wrote:
> This question is about the notation element. I've seen one or two
> examples about it. What I don't understand is if it really is used in
> real life.
I don't think it is. It's frequently mentioned as being one of the
less-used or not-used parts of XML.
> Could someone please give me an example of how an
> application that uses XML would benefit from including notations?
Notations provide a simple form of data typing that is similar to the
xsi:type attribute from XML Schemas. In both cases, the instance has an
attribute that specifies what the data type of the content is.
For example, the following states that the notation of the OrderDate
element is DATE. The DATE notation declaration identifies the notation
by its URI (http://www.dates.org/date).
<!DOCTYPE OrderDate [
<!NOTATION DATE SYSTEM 'http://www.dates.org/date'>
<!ELEMENT OrderDate (#PCDATA)>
Type NOTATION (DATE) #REQUIRED>
There is no requirement that the URI be resolvable. That is, like
namespace URIs, it can be just an identifier that the application
recognizes and say, "Oh, I recognize that. That means I process the
contents like this ..."
If the URI is resolvable, it might point to something useful, such as a
program to process the content. For example, suppose I have an unparsed
entity that points to a JPEG. The notation URI could point to a program
that displays JPEGs.
I suspect that one reason notations are not commonly used is that
applications generally know how to process their own XML documents. That
is, there is no reason to put data typing information into the XML
documents since it is already hard-coded in the application.