What is the difference between targetNamespace and xmlns:target? [duplicate]

Answered quite well over here: targetNamespace and xmlns without prefix, what is the difference? To restate: targetNamespace=”” – As the current XML document is a schema this attribute defines the namespace that this schema is intended to target, or validate. xmlns=”” – Defines the default namespace within the current document for all non-prefixed elements (i.e … Read more

Recursion in an XML schema?

if you need a recursive type declaration, here is an example that might help: <xs:schema id=”XMLSchema1″ targetNamespace=”http://tempuri.org/XMLSchema1.xsd” elementFormDefault=”qualified” xmlns=”http://tempuri.org/XMLSchema1.xsd” xmlns:mstns=”http://tempuri.org/XMLSchema1.xsd” xmlns:xs=”http://www.w3.org/2001/XMLSchema” > <xs:element name=”node” type=”nodeType”></xs:element> <xs:complexType name=”nodeType”> <xs:sequence minOccurs=”0″ maxOccurs=”unbounded”> <xs:element name=”node” type=”nodeType”></xs:element> </xs:sequence> </xs:complexType> </xs:schema> As you can see, this defines a recursive schema with only one node named “node” which can be as … Read more

cvc-elt.1: Cannot find the declaration of element ‘MyElement’

Your schema is for its target namespace http://www.example.org/Test so it defines an element with name MyElement in that target namespace http://www.example.org/Test. Your instance document however has an element with name MyElement in no namespace. That is why the validating parser tells you it can’t find a declaration for that element, you haven’t provided a schema … Read more

XSD Definition for Enumerated Value

You can define an enumeration within the context of a simpleType. <xs:simpleType name=”color” final=”restriction” > <xs:restriction base=”xs:string”> <xs:enumeration value=”green” /> <xs:enumeration value=”red” /> <xs:enumeration value=”blue” /> </xs:restriction> </xs:simpleType> <xs:element name=”SomeElement”> <xs:complexType> <xs:sequence> <xs:element name=”Color” type=”color” /> </xs:sequence> </xs:complexType> </xs:element>

Add attributes to a simpletype or restriction to a complextype in Xml Schema

To add attributes you have to derive by extension, to add facets you have to derive by restriction. Therefore this has to be done in two steps for the element’s child content. The attribute can be defined inline: <xsd:simpleType name=”timeValueType”> <xsd:restriction base=”xsd:token”> <xsd:pattern value=”\d{2}:\d{2}”/> </xsd:restriction> </xsd:simpleType> <xsd:complexType name=”timeType”> <xsd:simpleContent> <xsd:extension base=”timeValueType”> <xsd:attribute name=”format”> <xsd:simpleType> <xsd:restriction … Read more

Why is it called nillable?

What I’m wondering is why nil was chosen, rather than the more common (in computer science) null This depends on which part of computer science you’re coming from! If you look at programs written in functional languages, you’ll see nil every where, and very seldom null. And as it happens, XML and all it’s siblings … Read more

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

The difference is the following: xs:int is a signed 32-bit integer. xs:integer is an integer unbounded value. See for details https://web.archive.org/web/20151117073716/http://www.w3schools.com/schema/schema_dtypes_numeric.asp For example, XJC (Java) generates Integer for xs:int and BigInteger for xs:integer. The bottom line: use xs:int if you want to work cross platforms and be sure that your numbers will pass without a … Read more

what is the use of xsi:schemaLocation?

The Java XML parser that spring uses will read the schemaLocation values and try to load them from the internet, in order to validate the XML file. Spring, in turn, intercepts those load requests and serves up versions from inside its own JAR files. If you omit the schemaLocation, then the XML parser won’t know … Read more