Where is the XSD schema definition file for the namespace "http://www.w3.org/2001/XMLSchema-instance"?
SchemaViewer is a free program that will display XSD files in the proper tree format, which makes them easier to read than with a simple text editor like Notepad. The file can also open with Microsoft Visual Studio, XML Notepad, EditiX XML Editor, Progress Stylus Studio, and XMLSpy.
With the desired XML document opened in the active editor tab, choose Tools | XML Actions | Generate XSD Schema from XML File on the main menu. The Generate Schema From Instance Document dialog box opens. and select the desired file in the dialog that opens.
An XML schema definition (XSD), is a framework document that defines the rules and constraints for XML documents. An XSD formally describes the elements in an XML document and can be used to validate the contents of the XML document to make sure that it adheres to the rules of the XSD.
xmlns:xsi:http://www.w3.org/2001/XMLSchema-instance — Declared in the XML and is used to help declare that the XML document is an instance of and XSD. The convention is to use the namespace prefix of xsi. targetNamespace: is used in the header of the XSD to defined the namespace that the XSD describes.
Strange it may sound, but the XML schema for http://www.w3.org/2001/XMLSchema-instance
namespace does exist and is found exactly by the very URL denoted by the namespace URI:
http://www.w3.org/2001/XMLSchema-instance
For a proof, just open that link (URL) in an HTML browser (e.g. FireFox). You will probably see some HTML text, like: "XML Schema instance namespace ...". Then, save that 'HTML' as a file on your computer (e.g. File | Save Page As). When you look into this file, you will see that it is not HTML at all. Rather, it is a complete XML schema for that namespace!
Equally, you can import the http://www.w3.org/2001/XMLSchema-instance
namespace into your own schema as the following:
<xs:import namespace="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://www.w3.org/2001/XMLSchema-instance"/>
See also this question: Error while parsing xsd using xjc, which although sounds very differently, actually very much related to the same problem.
Just to add fuel to the fire -- many XML tools have knowledge of http://www.w3.org/2001/XMLSchema-instance baked-in, so it looks like you never need the schema at all. In fact, you need the schema if you are using an XML tool that does not bake-in this knowledge.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With