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.
14,212
questions
363
votes
11
answers
468k
views
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?
287
votes
13
answers
345k
views
How 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. How should I verify they conform?
285
votes
9
answers
263k
views
Generate C# class from XML
Can I generate a C# class from an XML file?
275
votes
14
answers
302k
views
XML Schema (XSD) validation tool? [closed]
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 ...
272
votes
21
answers
84k
views
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 ...
250
votes
3
answers
311k
views
XML Schema minOccurs / maxOccurs default values
I'm wondering how the XML Schema specification handles these cases:
<xsd:element minOccurs="1" name="asdf"/>
No maxOccurs given -> Is this the cardinality [1..1]?
<xsd:element minOccurs="5"...
231
votes
6
answers
167k
views
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?
214
votes
8
answers
267k
views
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?
205
votes
19
answers
277k
views
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 ...
174
votes
5
answers
271k
views
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 ...
154
votes
15
answers
237k
views
How to visualize an XML schema programatically? [closed]
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?
154
votes
3
answers
104k
views
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:
<option value="test">sometext</option>
I can't figure out how ...
153
votes
10
answers
203k
views
Any tools to generate an XSD schema from an XML instance document? [closed]
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 ...
150
votes
2
answers
398k
views
Using Notepad++ to validate XML against an XSD
Can someone explain how to use Notepad++ to validate an xml file against an xsd. There are no options in the "XML Tools" plugin dropdown that provides for specifying an XSD file. The XML plugin is ...
148
votes
11
answers
378k
views
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 ...
143
votes
4
answers
158k
views
what is the use of xsi:schemaLocation?
I see that we have multiple url's as value of this attribute like in spring:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:...
141
votes
8
answers
168k
views
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 ...
131
votes
2
answers
180k
views
How to make an element in XML schema optional?
So I got this XML schema:
<?xml version="1.0"?> <xs:schema version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:...
131
votes
7
answers
45k
views
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 ...
128
votes
3
answers
119k
views
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?
123
votes
7
answers
127k
views
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 ...
122
votes
7
answers
158k
views
What is the difference between XML and XSD?
What is the difference between Extensible Markup Language (XML) and XML Schema Definition (XSD)?
110
votes
6
answers
127k
views
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
...
109
votes
4
answers
97k
views
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:
<xs:element name="office" type="xs:NCName"/>
What exactly ...
107
votes
5
answers
108k
views
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 ...
107
votes
18
answers
175k
views
Spring schemaLocation fails when there is no internet connection
I am using Spring and in application-context.xml I have the following definitions:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:...
104
votes
6
answers
62k
views
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 ...
99
votes
1
answer
2k
views
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:
<xs:element name="MyReport" type="MyReportType" />
<xs:complexType name="MyReportType">
&...
97
votes
3
answers
72k
views
Difference between xs and xsd in XML schema file?
What is the difference between the xs and xsd prefixes in XML schema files?
95
votes
10
answers
200k
views
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 ...
95
votes
6
answers
127k
views
Difference between <xsd:all> and <xsd:sequence> 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 ...
94
votes
9
answers
134k
views
How can I tell jaxb / Maven to generate multiple schema packages?
Example:
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
&...
92
votes
2
answers
81k
views
xmlns, xmlns:xsi, xsi:schemaLocation, and targetNamespace?
For the following XML fragment:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache....
91
votes
13
answers
79k
views
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?
91
votes
3
answers
119k
views
XML Schema How to Restrict Attribute by Enumeration
I have the following XML Tag
<price currency="euros">20000.00</price>
How do I restrict the currency attribute to one the following:
euros
pounds
dollars
AND the price to a double?
I ...
87
votes
15
answers
121k
views
Remove 'standalone="yes"' from generated XML
Do you know of a JAXB setting to prevent standalone="yes" from being generated in the resulting XML?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
87
votes
20
answers
68k
views
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:
<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" ...
83
votes
6
answers
84k
views
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.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example....
82
votes
11
answers
75k
views
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 <xxx>"?
I.e. created a XSD with the button to create a scheme. I changed the ...
82
votes
5
answers
147k
views
Generate Json schema from XML schema (XSD) [closed]
Does anybody know how to generate a JSON schema from a existing XML schema (XSD file)?
Are there any tools available for this?
78
votes
10
answers
23k
views
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 ...
76
votes
2
answers
47k
views
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 ...
76
votes
7
answers
60k
views
Comparison of XSD Code Generators [closed]
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 ...
75
votes
5
answers
70k
views
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 ...
73
votes
3
answers
124k
views
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.
&...
73
votes
7
answers
80k
views
JAXB - Property "Value" is already defined. Use <jaxb:property> to resolve this conflict
Using JAXB to generate XML binding classes.
The schema is based on a set of legacy XML files, and includes this snippet:
<xs:complexType name="MetaType">
<xs:simpleContent>
&...
70
votes
2
answers
64k
views
Add attributes to a simpletype or restriction to a complextype in Xml Schema
The problem is as follows:
I have the following XML snippet:
<time format="minutes">11:60</time>
The problem is that I can't add both the attribute and the restriction at the same time. ...
70
votes
2
answers
111k
views
XSD Definition for Enumerated Value
I'm stuck trying to define an XSD containing a field that can have only one of the following three values:
Green
Red
Blue
Essentially, I want to define a strict enumeration at the Schema level.
My ...
69
votes
1
answer
74k
views
how to Validate a XML file with XSD through xmllint [duplicate]
i have to validate my xml file with a given XSD file. Figured the easiest way to do so would be xmllint, but i can't get it to work. Can anyone tell me the exact command?
I tried:
xmllint --...
69
votes
5
answers
33k
views
XSD - one of 2 attributes is required?
Is there a way to specify that one of 2 attributes is required in XSD?
for example, I have a definition like this:
<xs:attribute name="Name" type="xs:string" use="optional" />
<xs:attribute ...