Namespace in XMLDocument
-
-
Hi, I am sorry if this is a very basic question. I am new to XMLs. I am using .net XMLDocument class to operate with xml files. I would like to know what is the significance of a namespace when parsing XMLs. what and why is a namespace used? Thanks.
VSush wrote:
what and why is a namespace used?
The base reason for "namespace" support in any code based language is to reduce name collisions. so if you want an xml element named ECustom and so do I we can't use them both in a single document. However if we add a namespace then they become VSush.ECustom and led-mike.ECustom So now they are two different elements and both can be used in a single document without ambiguity.
led mike
-
VSush wrote:
what and why is a namespace used?
The base reason for "namespace" support in any code based language is to reduce name collisions. so if you want an xml element named ECustom and so do I we can't use them both in a single document. However if we add a namespace then they become VSush.ECustom and led-mike.ECustom So now they are two different elements and both can be used in a single document without ambiguity.
led mike
Adding to led mike's answer, Preventing name collisions is the major reason for using namespaces. Nevertheless, the grouping of names for a specific purpose is a pleasant side-affect of this. Thus, for example, you can have elements that refer to schemas, html, xslt and xml in the same document. George