In: Computer Science
What are two ways in which namespaces can be represented within an XML document? How is the scope of a particular XML element within a document determined based on these two namespace types?
XML NAMESPACES:
The Internet is filled with XML documents. Even inside of a company or a department, many people create XML or XML-types of documents on a daily basis. One of the things that these many documents share is that they use same words or names, by coincidence or without any intention. The ultimate problem is that, when two XML documents are accessed in the same application, if those two documents use the same name, there could be a conflict of names.
A namespace is a technique of qualifying a name so that it would not conflict with another name. Normally, you should already be familiar with namespaces because they are used in F#. The concept is primarily the same in XML. You create a namespace in your XML document so that its elements and attributes can be accessed outside that document without worrying about name conflicts because the names of your document will be qualified.
Namespaces can be represented within an XML document by two ways
A Namespace is declared using reserved attributes. Such an attribute name must either be xmlns or begin with xmlns: shown as below −
The Namespace starts with the keyword xmlns.
The word name is the Namespace prefix.
The URL is the Namespace identifier.
scope of a particular XML element within a document determined based on these two namespace types
Ans:
Namespace affects only a limited area in the document. An element containing the declaration and all of its descendants are in the scope of the Namespace. Following is a simple example of XML Namespace −
OR You can check these images also for better understanding
Two ways in which namespaces can be represented within an XML document
Explanation:
scope of a particular XML element within a document determined based on these two namespace types: