XML syntax (3)-attributes, declarative symbols, character data, and comments
- Attribute: Provide additional information about the element.
- Attribute is part of the element start tag. Eg:
- <Para keywords = "Napoleon, France, history">
- ...
- </Para>
- Note:
- Attributes are composed of "name" and "value", separated by "=. Values are enclosed by quotation marks. If they contain double quotation marks, they are enclosed by single quotation marks, and vice versa.
- A tag can contain multiple attributes: <para topic = "xml" author = "J. Smith" lastrevised = "10/30/2000">
- Attribute names and values are case sensitive.
- The attribute names starting with "xml:" are retained.
- Declaration symbol
- Symbol is used to define how external binary data will be processed.
- Eg: <! ENTITY coverphoto SYSTEM "/images/cover. tif" ndata tiff>
NDATA declares the non-text data format TIFF, but must also specify the application that processes the data format
- <! Notation tiff system "/programs/show1_.exe">
- Generally (SYSTEM): <! NOTATION FormatName SYSTEM "AppIdentifier">
- Or (PUBLIC): <! NOTATION TeX PUBLIC "-// SmithCo // NOTATION TeX HelpFile // EN" "programs \ texdisplay.exe">
First, use the program corresponding to the Public identifier (URI) "-// SmithCo // NOTATION TeX HelpFile // EN". Otherwise, use "programs \ texdisplay.exe" for processing.
- In particular, when no information is available and no application is available to process the format, it still needs to be declared in the smallest symbol format:
<! NOTATION FormatName "">
- Character data: it does not need to be processed by the XML Parser and is placed in the CDATA tag.
- <! [CDATA [The character data goes here]>
- <! [CDATA [
<Firstname> Alice </firstname>
<Lastname> Walker </lastname>
]>
The "tag" symbol and content will be ignored. Common usage:
- Reference XML Code Section
- Contains all types of script code that may contain XML Reserved Words
- Note: <! -- ...... -->