what are xml schemas

  • Thread starter Thread starter Madhur
  • Start date Start date
M

Madhur

Hello

I am a .net developer and normally see the entries like
<webparts xmlns="schemas.microsoft.com/webparts/v2>

I get confused here about what does xmlns refers to and how does the program
locates this schema.

Since this schema refers to internet location, but a normal program doesnt
require an Internet location?

Where is this schema stored and how can I view them?
 
Madhur said:
I am a .net developer and normally see the entries like
<webparts xmlns="schemas.microsoft.com/webparts/v2>

I get confused here about what does xmlns refers to and how does the program
locates this schema.

'xmlns' means an XML namespace, and it is not a schema. The URI referred
to by the 'xmlns' attribute doesn't need to be a valid location from
which stuff can be downloaded. What it does is scope attributes and
elements by the given namespace. It's a little like namespaces in .NET &
C# - it permits the same identifier (an element or attribute in XML) to
be used in different namespaces without conflicting with one another.
Since this schema refers to internet location, but a normal program doesnt
require an Internet location?

Even for schemas, XML documents are typically not validated against the
schema unless you use a validating reader. Using a validating reader can
slow things down, so they aren't always used.
Where is this schema stored and how can I view them?

Schemas are generally in a DTD (document type definition) header at the
start of the document, or in an 'xsd' (XML schema definition) attribute.
There are other schema definition formats too.

-- Barry
 
Barry said:
'xmlns' means an XML namespace, and it is not a schema. The URI
referred to by the 'xmlns' attribute doesn't need to be a valid
location from which stuff can be downloaded. What it does is scope
attributes and elements by the given namespace. It's a little like
namespaces in .NET & C# - it permits the same identifier (an element
or attribute in XML) to be used in different namespaces without
conflicting with one another.


Even for schemas, XML documents are typically not validated against
the schema unless you use a validating reader. Using a validating
reader can slow things down, so they aren't always used.


Schemas are generally in a DTD (document type definition) header at
the start of the document, or in an 'xsd' (XML schema definition)
attribute. There are other schema definition formats too.

-- Barry

I got your point! But as you said they are just namespaces, If I change
one of them, .NET compilation throws error that this namespace is not a
valid one. I want to know how it determines validity and where this info
is stored.
For ex .dwp file use namespace
schemas.microsoft.com/webparts/v2
while the v3 of .dwp file use
schemas.microsoft.com/webparts/v3

I dont see this info documented anywhere, and how can I see the difference
between two.
 
I got your point! But as you said they are just namespaces, If I change
one of them, .NET compilation throws error that this namespace is not a
valid one. I want to know how it determines validity and where this info
is stored.

If you change the namespace, it's as if you changed the element name -
if the program is XML namespace aware, it won't recognize the element at
all.

No schema needs to be anywhere for this to occur - the program may be
reading hard-coded namespace-element name pairs from the XML.
For ex .dwp file use namespace
schemas.microsoft.com/webparts/v2
while the v3 of .dwp file use
schemas.microsoft.com/webparts/v3

I dont see this info documented anywhere, and how can I see the difference
between two.

The difference between the two is that one ends in '2' and the other in
'3', it seems to me.

-- Barry
 
Back
Top