Q&A

Q1:Why is it necessary to define and use a notation if you want to use an external resource that is not text?
A1: The XML processor understands only text and has no functionality built into it to process other files. A notation is the way that you call other programs including the input that they are to process.
Q2:Why would you use attributes in an XML file?
A2: Because in many cases, one word or phrase is not enough. While it's possible to use a complete phrase inside the data, a value such as the following would have to be parsed by the programmer, which would make your programs much more complex:
<NodeName>Node value is 12 and the parameter is Hello</NodeName>

With attributes, you can write this:

 <NodeName parameter="Hello">12</NodeName> ...

Get Sams Teach Yourself XML in 24 Hours 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.