Difference between xs and xsd in XML schema file?

XmlData StructuresXsd

Xml Problem Overview


What is the difference between the xs and xsd prefixes in XML schema files?

Xml Solutions


Solution 1 - Xml

From the XSD 1.0 spec on w3.org:

> The XML representation of schema > components uses a vocabulary > identified by the namespace name > http://www.w3.org/2001/XMLSchema. For > brevity, the text and examples in this > specification use the prefix xs: to > stand for this namespace; in practice, > any prefix can be used.

in the end xs or xsd are only prefixes. XSD is used for example more by Microsoft schemas.

The important is how you declare the namespace.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  ...
</xs:schema>

or

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  ...
</xsd:schema>

should be equivalent.

Solution 2 - Xml

There is no difference, it is just a matter of choice

Solution 3 - Xml

The xs: and xsd: are called namespace prefixes. They are declared using xmlns elements in the root element.

By convention people tend to choose either xs: or xsd: and map that to http://www.w3.org/2001/XMLSchema. Having both in a single document is confusing and should be avoided.

Check your xmlns declarations to determine what the namespaces are.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionunknown (google)View Question on Stackoverflow
Solution 1 - XmlDrakeView Answer on Stackoverflow
Solution 2 - XmlcarpinchosaurioView Answer on Stackoverflow
Solution 3 - XmlHarshal BhamareView Answer on Stackoverflow