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:

13540 questions
339
votes
11 answers

How to generate .NET 4.0 classes from xsd?

What are the options to generate .NET 4.0 c# classes (entities) from an xsd file, using Visual Studio 2010?
Bastien Vandamme
  • 15,236
  • 25
  • 92
  • 166
272
votes
13 answers

What's the best way to validate an XML file against an XSD file?

I'm generating some xml files that needs to conform to an xsd file that was given to me. What's the best way to verify they conform?
Jeff
  • 3,102
  • 3
  • 20
  • 12
270
votes
14 answers

XML Schema (XSD) validation tool?

At the office we are currently writing an application that will generate XML files against a schema that we were given. We have the schema in an .XSD file. Are there tool or libraries that we can use for automated testing to check that the…
Jason Dagit
  • 13,034
  • 8
  • 31
  • 54
257
votes
20 answers

XML attribute vs XML element

At work we are being asked to create XML files to pass data to another offline application that will then create a second XML file to pass back in order to update some of our data. During the process we have been discussing with the team of the…
Jacob Schoen
  • 13,416
  • 15
  • 79
  • 100
255
votes
8 answers

Generate C# class from XML

Can I generate a C# class from an XML file?
user496949
  • 75,601
  • 138
  • 297
  • 413
228
votes
4 answers

XML Schema minOccurs / maxOccurs default values

I'm wondering how the XML Schema specification handles these cases: No maxOccurs given -> Is this the cardinality [1..1]? I suppose this is simply…
Chris
  • 8,649
  • 16
  • 55
  • 73
212
votes
6 answers

What's the difference between xsd:include and xsd:import?

What's the difference between xsd:include and xsd:import? When would you use one instead of the other, and when might it not matter?
Pops
  • 28,257
  • 34
  • 127
  • 149
195
votes
8 answers

What is the difference between XSD and WSDL?

What is the difference between an XML Schema and WSDL? The difference I noticed is that WSDL contains XSD and in WSDL we can declare operations, but not in XSD. Is that correct?
make
  • 727
  • 7
  • 20
  • 36
188
votes
19 answers

How to generate sample XML documents from their DTD or XSD?

We are developing an application that involves a substantial amount of XML transformations. We do not have any proper input test data per se, only DTD or XSD files. We'd like to generate our test data ourselves from these files. Is there an…
lindelof
  • 31,966
  • 30
  • 87
  • 133
167
votes
5 answers

Validating an XML against referenced XSD in C#

I have an XML file with a specified schema location such as this: xsi:schemaLocation="someurl ..\localSchemaPath.xsd" I want to validate in C#. Visual Studio, when I open the file, validates it against the schema and lists errors perfectly. …
jfclavette
  • 3,367
  • 2
  • 18
  • 17
149
votes
10 answers

Any tools to generate an XSD schema from an XML instance document?

I am looking for a tool which will take an XML instance document and output a corresponding XSD schema. I certainly recognize that the generated XSD schema will be limited when compared to creating a schema by hand (it probably won't handle optional…
Matt Dillard
  • 14,229
  • 7
  • 48
  • 60
148
votes
15 answers

How to visualize an XML schema programatically?

I have made an XML Schema - all the code basically - and was wondering if there is a way that the code can generate something like this: If so how can I do it?
matt
  • 1,555
  • 2
  • 10
  • 4
137
votes
13 answers

Generate Java classes from .XSD files...?

I have a gigantic QuickBooks SDK .XSD schema file which defines XML requests/responses that I can send/receive from QuickBooks. I'd like to be able to easily generate Java classes from these .XSD files, which I could then use to marshal XML to Java…
Keith Palmer Jr.
  • 26,497
  • 16
  • 62
  • 103
137
votes
3 answers

XML Schema: Element with attributes containing only text?

I'm having difficulty searching for this. How would I define an element in an XML schema file for XML that looks like this: I can't figure out how to define an element that is of type xs:string and also has an…
Wilco
  • 31,070
  • 47
  • 124
  • 158
136
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
  • 8,917
  • 11
  • 38
  • 48
1
2 3
99 100