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
142
votes
4 answers

what is the use of xsi:schemaLocation?

I see that we have multiple url's as value of this attribute like in spring:
sab
  • 9,767
  • 13
  • 44
  • 51
135
votes
8 answers

Validating with an XML schema in Python

I have an XML file and an XML schema in another file and I'd like to validate that my XML file adheres to the schema. How do I do this in Python? I'd prefer something using the standard library, but I can install a third-party package if necessary.
Eli Courtwright
  • 186,300
  • 67
  • 213
  • 256
129
votes
7 answers

XML schema or DTD for logback.xml?

I've seen several discussions on the net about how great it would be to have an XML schema or DTD for logback.xml file to have at least the very basic validation and auto-completion in IDEs like IDEA or Eclipse, but I never saw any solution. Did…
Vladislav Rastrusny
  • 29,378
  • 23
  • 95
  • 156
128
votes
2 answers

How to make an element in XML schema optional?

So I got this XML schema:
Richard Knop
  • 81,041
  • 149
  • 392
  • 552
125
votes
3 answers

XSD: What is the difference between xs:integer and xs:int?

I have started to create XSD and found in couple of examples for xs:integer and xs:int. What is the difference between xs:integer and xs:int? When I should use xs:integer? When I should use xs:int?
Michael
  • 10,063
  • 18
  • 65
  • 104
121
votes
7 answers

XSD - how to allow elements in any order any number of times?

I am trying to create an XSD, and trying to write the definition with the following requirement: Allow child element specified to appear any number of times (0 to unbounded) Allow child elements to be in any order I looked around and found various…
jvtech
  • 1,369
  • 3
  • 9
  • 10
120
votes
7 answers

What is the difference between XML and XSD?

What is the difference between Extensible Markup Language (XML) and XML Schema Definition (XSD)?
Gandalf StormCrow
  • 25,788
  • 70
  • 174
  • 263
109
votes
6 answers

What does elementFormDefault do in XSD?

What does elementFormDefault do, and when should it be used? So I found some definitions for elementFormDefault values: qualified - elements and attributes are in the targetNamespace of the schema unqualified - elements and attributes do not…
Levi
  • 12,214
  • 14
  • 43
  • 47
107
votes
18 answers

Spring schemaLocation fails when there is no internet connection

I am using Spring and in application-context.xml I have the following definitions:
Altug
  • 1,723
  • 3
  • 19
  • 27
106
votes
4 answers

What is an xs:NCName type and when should it be used?

I ran one of my xml files through a schema generator and everything generated was what was expected, with the exception of one node: What exactly is xs:NCName? And why would one use it, rather…
user189320
105
votes
5 answers

XML Validation with XSD in Visual Studio IDE

I know I have done this before, but it isn't working today, nor can I find anywhere that explains how to do it. It could be my lack of sleep, but I suspect gremlins. I have an XML document and a directory full of XSD's that define it. How do I…
Jim McKeeth
  • 38,225
  • 23
  • 120
  • 194
102
votes
6 answers

YAML Schema Validation?

Is there a schema validation language for YAML? I've googled but couldn't find anything useful. Something like XSD format, using the language itself to describe the schema, would be the best choice in my case.
Klaim
  • 67,274
  • 36
  • 133
  • 188
99
votes
1 answer

Required tags not present when using Delphi XML Data Binding Wizard

I am using the XML Data Binding Wizard in Delphi XE2. The schema has required tags of this type:
Randomeister
  • 1,125
  • 6
  • 5
95
votes
3 answers

Difference between xs and xsd in XML schema file?

What is the difference between the xs and xsd prefixes in XML schema files?
unknown (google)
94
votes
9 answers

How can I tell jaxb / Maven to generate multiple schema packages?

Example: org.jvnet.jaxb2.maven2 maven-jaxb2-plugin 0.7.1
M.R.
  • 1,959
  • 4
  • 24
  • 32