1

I know basics of namespaces in XML. Basically they provides the context of that element to processor(processor can be validator,parser, tranformer etc).

Cotext here means :- say i have two elements with same name elementA . When i prefix p:elementA and v:elementA i am providing the processor some meta data(processor already knows what to do with this meta data) so that it know elementA with prefix p is different from element with prefix v. Is that correct ?

say i have below xml

<p:Person
   xmlns:p="http://contoso.com/People"
   xmlns:v="http://contoso.com/Vehicles"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation=
    "http://contoso.com/schemas/Vehicles
     http://contoso.com/schemas/vehicles.xsd
     http://contoso.com/schemas/People
     http://contoso.com/schemas/people.xsd"
     targetNamespace="....">
   <name>John</name>
   <age>28</age>
   <height>59</height>
   <v:Vehicle>
      <color>Red</color>
      <wheels>4</wheels>
      <seats>2</seats>
   </v:Vehicle>
</p:Person>

What is the usage/relevance of schemaLocation and targetNameSpace here or in any xml ?

emilly
  • 10,060
  • 33
  • 97
  • 172
  • http://stackoverflow.com/questions/1181888/what-does-xmlns-in-xml-mean – Quentin Apr 26 '15 at 12:09
  • @emilly It's better to ask one question per question. You basic explanation of namespaces is more or less correct. Schemalocation is explained in the duplicate post. – Tomalak Apr 26 '15 at 12:15

0 Answers0