What is the difference between xsd and xsi?

xsd and xsi Similarities Both are XML namespace prefixes, abbreviations for an XML namespace. Both are, as are all namespace prefixes, arbitrarily named; other namespace prefix abbreviations could equally well be used. However, both prefixes are conventional and therefore recommended. (An also-conventional alternative to xsd is xs.) xsd and xsi Differences The xsd (or xs) … Read more

XML validation with XSD: how to avoid caring about the sequence of the elements?

<xsd:complexType name=”questions”> <xsd:all> <xsd:element name=”location” type=”location”/> <xsd:element name=”multipleChoiceInput” type=”multipleChoiceInput”/> <xsd:element name=”textInput” type=”textInput”/> <xsd:element name=”pictureInput” type=”pictureInput”/> </xsd:all> </xsd:complexType> NOTE: I have changed “sequence” to “all” Sequence forces order (as defined). if order doesn’t matter then all is used. If there are chances of element occurence more than once then xsd:any can be used. <xsd:complexType name=”questions”> <xsd:sequence> … Read more

How to choose between DTD and XSD

It’s probably important to learn DTDs as a separate exercise, just for the knowledge of how they work in case you encounter them somewhere else, and so that you can appreciate some of the things that XSD was trying to solve. However, for your current purposes of describing an XML document, indeed stick to XSDs. … Read more

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

@skyl practically provoked me to write this answer so please mind the redundancy. NCName stands for “non-colonized name”. NCName can be defined as an XML Schema regular expression [\i-[:]][\c-[:]]* …and what does that regex mean? \i and \c are multi-character escapes defined in XML Schema definition. http://www.w3.org/TR/xmlschema-2/#dt-ccesN \i is the escape for the set of … Read more

How to deal with JAXB ComplexType with MixedContent data?

As you mentioned you need to add the mixed attribute to indicate that your type supports mixed content. Without this specified your XML content is invalid: <xsd:complexType name=”TaxDescriptionType” mixed=”true”> <xsd:sequence> <xsd:element name=”ShortName” type=”xsd:string” /> </xsd:sequence> <xsd:attribute ref=”xml:lang” /> </xsd:complexType> The generated TaxDescriptionType class will have the following property. Essentially this means that all of the … Read more

Visual Studio always selects the wrong xsd for App.config

I interpret the problem as follows: the file DotNetConfig.xsd has wrong (or not full) definition of the <startup> element. Line 230 of all DotNetConfig.xsd, DotNetConfig35.xsd, DotNetConfig30.xsd and DotNetConfig20.xsd files contains <xs:element name=”startup” vs:help=”configuration/startup” /> On the other side Microsoft describes the startup settings schema as a non-empty element. So I suggest to replace the above … 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>