Name

NOTATION Attribute Type

Synopsis

                        ... NOTATION (
                        notation 
                        [
                        | 
                        notation]
                        *) ...

The NOTATION attribute mechanism lets XML document authors indicate that the character content of some elements obey the rules of some formal language other than XML. The following short sample document shows how notations might be used to specify the type of programming language stored in the code_fragment element:

<?xml version="1.0"?>
<!DOCTYPE code_fragment
[
<!NOTATION java_code PUBLIC "Java source code">
<!NOTATION c_code PUBLIC "C source code">
<!NOTATION perl_code PUBLIC "Perl source code">
<!ELEMENT code_fragment (#PCDATA)>
<!ATTLIST code_fragment
          code_lang NOTATION (java_code | c_code | perl_code) #REQUIRED>
     
]>
<code_fragment code_lang="c_code">
    main( ) { printf("Hello, world."); }
</code_fragment>

Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.