Which mechanism in XML allows organizations to specify globally unique names…
2022
Which mechanism in XML allows organizations to specify globally unique names as element tags in documents ?
- A.
root
- B.
header
- C.
schema
- D.
namespace
Attempted by 169 students.
Show answer & explanation
Correct answer: D
Answer: XML namespaces allow organizations to specify globally unique names for elements and attributes by qualifying names with a URI.
Namespaces prevent name collisions by qualifying names with a namespace identifier (a URI) and an optional prefix.
Namespaces are declared using xmlns or xmlns:prefix="URI" on an element.
Elements and attributes are then written using prefix:localName (or belong to the default namespace if declared without a prefix).
Example: <root xmlns:ex="http://example.com/ns"> <ex:item>Value</ex:item> </root>
Note: The namespace URI is an identifier used to distinguish names; it does not have to point to a retrievable resource.
A video solution is available for this question — log in and enroll to watch it.