Questions tagged [xsd]

XSD generally refers to a document written in the W3C XML Schema format, containing a description of a particular type of XML document.

XML Schema, published as a W3C recommendation in May 2001, is one of several XML schema languages.

Because of confusion between XML Schema as a specific W3C specification, and the use of the same term to describe schema languages in general, some parts of the user community referred to this language as WXS, an initialism for W3C XML Schema, while others referred to it as XSD, an initialism for XML Schema Document — a document written in the XML Schema language, typically containing the "xsd" XML namespace prefix and stored with the ".xsd" filename extension.

As of April 5th 2012, the XML Schema Definition (XSD) 1.1 is a W3C Recommendation; W3C has adopted XSD as the preferred acronym.

What is an XML Schema?

The purpose of an XML Schema is to define the legal building blocks of an XML document, just like a DTD.

An XML Schema:

  • defines elements that can appear in a document.
  • defines attributes that can appear in a document.
  • defines which elements are child elements.
  • defines the order of child elements.
  • defines the number of child elements.
  • defines whether an element is empty or can include text.
  • defines data types for elements and attributes.
  • defines default and fixed values for elements and attributes.

See also:

14065 questions
94
votes
6 answers

Difference between and in schema definition?

I am using xsd:all in a complex type. When I miss any mandatory elements while validating it will show all the elements. It will not display the exact missed element. But if I am use xsd:sequence I can get the exact missed element. Is there any…
user1679378
  • 1,370
  • 3
  • 17
  • 23
93
votes
10 answers

What is the purpose of XSD files?

Since we can query on the XML file from C# (.NET), why do we need an XSD file? I know it is metadata file of particular XML file. We can specify the relationships in XSD, but what is its functioning then? XML
Red Swan
  • 15,157
  • 43
  • 156
  • 238
90
votes
3 answers

XML Schema How to Restrict Attribute by Enumeration

I have the following XML Tag 20000.00 How do I restrict the currency attribute to one the following: euros pounds dollars AND the price to a double? I just get an error when I try to a type on both, here's what…
Luke
  • 22,826
  • 31
  • 110
  • 193
89
votes
13 answers

Is there any difference between 'valid xml' and 'well formed xml'?

I wasn't aware of a difference, but a coworker says there is, although he can't back it up. What's the difference if any?
user18931
  • 10,715
  • 9
  • 28
  • 21
87
votes
20 answers

How to use jQuery for XML parsing with namespaces

I'm new to jQuery and would like to parse an XML document. I'm able to parse regular XML with the default namespaces but with XML such as:
Brian Liang
  • 7,734
  • 10
  • 57
  • 72
87
votes
13 answers

Remove 'standalone="yes"' from generated XML

Do you know of a JAXB setting to prevent standalone="yes" from being generated in the resulting XML?
Johan Pelgrim
  • 6,033
  • 6
  • 37
  • 46
86
votes
2 answers

xmlns, xmlns:xsi, xsi:schemaLocation, and targetNamespace?

For the following XML fragment:
smwikipedia
  • 61,609
  • 92
  • 309
  • 482
83
votes
6 answers

targetNamespace and xmlns without prefix, what is the difference?

In an xml schema document, if I have both the targetNamespace and the xmlns without a prefix. What is the exact…
Abe
  • 8,623
  • 10
  • 50
  • 74
82
votes
5 answers

Generate Json schema from XML schema (XSD)

Does anybody know how to generate a JSON schema from a existing XML schema (XSD file)? Are there any tools available for this?
JB Hurteaux
  • 4,428
  • 6
  • 32
  • 35
81
votes
11 answers

Fix: The Global element 'configuration' has already been declared

I used the second solution of How to resolve "Could not find schema information for the element/attribute "? I.e. created a XSD with the button to create a scheme. I changed the stylesheet in app.config to app.xsd but now I get the warning: The…
Michel Keijzers
  • 15,025
  • 28
  • 93
  • 119
78
votes
10 answers

What are XML namespaces for?

This is something that I always find a bit hard to explain to others: Why do XML namespaces exist? When should we use them and when should we not? What are the common pitfalls when working with namespaces in XML? Also, how do they relate to XML…
Doron Yaacoby
  • 9,412
  • 8
  • 48
  • 59
76
votes
7 answers

Comparison of XSD Code Generators

I'm doing some research in code generation from xsd schema files. My requirements: Must generate C# 2.0 code (or above), using generic collections where needed. Must generate comments from the xsd comments Must generate fully serializable…
edosoft
  • 17,121
  • 25
  • 77
  • 111
75
votes
5 answers

Why is it called nillable?

In an XML schema you can mark an element as nillable meaning it can take an explicit NULL value. See nillable and minOccurs XSD element attributes for a great explanation. What I'm curious about is why is it called nillable? I always see nillable…
RB.
  • 36,301
  • 12
  • 91
  • 131
74
votes
2 answers

What are the best practices for versioning XML schemas?

I often have to design XML schemas for different XML-bases import routines. It is clear that XML schemas will evolve over time or they could contain bugs to be fixed, so it is important to capture the schema's version and to have some mechanism to…
Regent
  • 5,502
  • 3
  • 33
  • 59
73
votes
3 answers

Use of Greater Than Symbol in XML

I had created the xml document with xml version="1.0". In that document I need to use the greater than symbol > and less than symbol <. How should I include those symbols? It's not working. > and < are not working for me. Is there any special…
praveenjayapal
  • 37,683
  • 30
  • 72
  • 72