What is the advantage of having multiple namespace in xml document


see below xml. when can build xml without namespace why people use multiple or 1 namespace in xml. know reason , advantage in details. when incorporate namespace need add code parse it.....so point.

if possible explain advantage sample xml. thanks

<soapenv:envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/""> 	        <soapenv:header/> 	        <soapenv:body> 		        <rate:rateresponse xmlns:rate=""http://www.ups.com/xmlschema/xoltws/rate/v1.1""> 			        <common:response xmlns:common=""http://www.ups.com/xmlschema/xoltws/common/v1.0""> 				        <common:responsestatus> 					        <common:code>1</common:code> 					        <common:description>success</common:description> 				        </common:responsestatus> 				        <common:alert> 					        <common:code>110971</common:code> 					        <common:description>your invoice may vary displayed reference rates</common:description> 				        </common:alert> 				        <common:transactionreference/> 			        </common:response> 			        <rate:ratedshipment> 				        <rate:service> 					        <rate:code>07</rate:code> 					        <rate:description/> 				        </rate:service> 				        <rate:ratedshipmentalert> 					        <rate:code>110971</rate:code> 					        <rate:description>your invoice may vary displayed reference rates</rate:description> 				        </rate:ratedshipmentalert> 				        <rate:billingweight> 					        <rate:unitofmeasurement> 						        <rate:code>kgs</rate:code> 						        <rate:description>kilograms</rate:description> 					        </rate:unitofmeasurement> 					        <rate:weight>1.0</rate:weight> 				        </rate:billingweight> 				        <rate:transportationcharges> 					        <rate:currencycode>eur</rate:currencycode> 					        <rate:monetaryvalue>102.31</rate:monetaryvalue> 				        </rate:transportationcharges> 				        <rate:serviceoptionscharges> 					        <rate:currencycode>eur</rate:currencycode> 					        <rate:monetaryvalue>0.00</rate:monetaryvalue> 				        </rate:serviceoptionscharges> 				        <rate:totalcharges> 					        <rate:currencycode>eur</rate:currencycode> 					        <rate:monetaryvalue>102.31</rate:monetaryvalue> 				        </rate:totalcharges> 				        <rate:negotiatedratecharges> 					        <rate:totalcharge> 						        <rate:currencycode>eur</rate:currencycode> 						        <rate:monetaryvalue>101.29</rate:monetaryvalue> 					        </rate:totalcharge> 				        </rate:negotiatedratecharges> 				        <rate:guaranteeddelivery> 					        <rate:businessdaysintransit>1</rate:businessdaysintransit> 					        <rate:deliverybytime>10:30 a.m.</rate:deliverybytime> 				        </rate:guaranteeddelivery> 				        <rate:ratedpackage> 					        <rate:weight>1.0</rate:weight> 				        </rate:ratedpackage> 			        </rate:ratedshipment> 			        <rate:ratedshipment> 				        <rate:service> 					        <rate:code>11</rate:code> 					        <rate:description/> 				        </rate:service> 				        <rate:ratedshipmentalert> 					        <rate:code>110971</rate:code> 					        <rate:description>your invoice may vary displayed reference rates</rate:description> 				        </rate:ratedshipmentalert> 				        <rate:billingweight> 					        <rate:unitofmeasurement> 						        <rate:code>kgs</rate:code> 						        <rate:description>kilograms</rate:description> 					        </rate:unitofmeasurement> 					        <rate:weight>1.0</rate:weight> 				        </rate:billingweight> 				        <rate:transportationcharges> 					        <rate:currencycode>eur</rate:currencycode> 					        <rate:monetaryvalue>46.38</rate:monetaryvalue> 				        </rate:transportationcharges> 				        <rate:serviceoptionscharges> 					        <rate:currencycode>eur</rate:currencycode> 					        <rate:monetaryvalue>0.00</rate:monetaryvalue> 				        </rate:serviceoptionscharges> 				        <rate:totalcharges> 					        <rate:currencycode>eur</rate:currencycode> 					        <rate:monetaryvalue>46.38</rate:monetaryvalue> 				        </rate:totalcharges> 				        <rate:negotiatedratecharges> 					        <rate:totalcharge> 						        <rate:currencycode>eur</rate:currencycode> 						        <rate:monetaryvalue>45.92</rate:monetaryvalue> 					        </rate:totalcharge> 				        </rate:negotiatedratecharges> 				        <rate:ratedpackage> 					        <rate:weight>1.0</rate:weight> 				        </rate:ratedpackage> 			        </rate:ratedshipment> 		        </rate:rateresponse> 	        </soapenv:body>         </soapenv:envelope>";


the same reasons apply namespaces in xml e.g. in .net. imporant: avoid name collisions. xml document or fragment must not contain data 1 source.

see also: use xml namespaces



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user