xsd-validation

XSD Validation of XML file having non-deterministic occurance of elements.

The following XML snippet is parsable using standard XML lib (tried with Java and Scala). <?xml version="1.0" encoding="UTF-8"?> <list> <a>value1</a> <b>value2</b> <a>value3</a> <a>value4</a> <a>value5</a> <b>value6</b> <b>value7</b> </list> As you can see 'a' and 'b' elements are mixed (non deterministic). Is it possible to write a X...

How to ignore the validation of Unknown tags ?

One more challenge to the XSD capability,I have been sending XML files by my clients, which will be having 0 or more undefined or [call] unexpected tags (May appear in hierarchy). Well they are redundant tags for me .. so I have got to ignore their presence, but along with them there are some set of tags which are required to be validat...

How to exclude an enumeration value in XML file using XSD?

Is it possible to specify the value of a tag or attribute should not be like some_value ? I have a strange requirement, where the xsd isn't aware of the values being sent to it. The value of that particular tag can be a string with any value except one value ( say data_migration). The sender should be acknowledged with the error, if t...

XSD complexContent element one name multiple forms

the name sums it up GRP2 can come in multiple shapes and flavors heres my schema <xsd:element name="root"> <xsd:complexType> <xsd:sequence> <xsd:element name="GRP1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="GRP1"> ...

Why my test xml is failing with very simple XSD Schema?

Hi all, I am a bit novice in xml schema. I would be grateful if somebody help me out to understand why my xml is not being validated with the schema: Here is my Schema: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/testSchema" xmlns="http://www.exam...

xs:key, why is validation passing when key value is not member of key reference?

Hello SO, I am interested in defining a key constraint in my Xsd. It is my understanding that using xs:key should constrain the value used to a member of a referenced list of values. Assuming we are using the sample Xsd, <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="namespace1" xmlns:r...

How to create an xml schema with key/keyrefs for nested elements of the same type

I work with some XML files on a regular basis and want to have better validation then a DTD can provide. So I started reading about schemas to see if would help me out. So far I've been able to create something that works almost like I need except for one piece. I want to be able to restrict the attribute of an element to the values of a...

How can I validate XML against an XSD with distinct imports and namespaces?

Hi there!! I am trying to validate a few XML files and I'm failing due to various issues with the XSD definition and the namespaces... This is public info, so no problem sharing data: the main XSD is at http://bioinformatics.ua.pt/euadr/euadr_types.xsd and it imports another XSD at the same location named common_types.xsd, I've validat...

How to verify XML attributes using XSD enumeration?

I have the following XML sequence <property name="a" value="x" /> <property name="b" value="xx" /> I want to limit "a" to a list of values, like [ x, y, z] and "b" to another list like [xx, yy, zz] Is it possible to do this using XSD, and if it is how? If this is not possible, how do you recommend to change the XML format in order...

XSD: How do I import a data type from another XSD?

Hello, I have the following start of an XSD: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:no="http://www.sychophants.com"&gt; <xs:import namespace="http://www.sychophants.com" schemaLocation="current_obs.xsd"/> ...and then some other definitions... <xs:element name="noI...

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 directory full of XSD's that define it. How do I set the Visual IDE up to notify me of validation failures, and then provide an intellisens...

Which one is erroneous? Schema file or Xml file

Here is my schema and xml file contents.When I want to validate my xml file with my schema file I got the error:Element X1 is not defined in this scope. Error line: 25 Error column: 12. Where is the problem? <xs:complexType name="LabelType"> <xs:sequence> <xs:element name="Text" type="xs:string"/> <xs:element ...

Mixed Type XSD Validation help

Hey, I've been tasked with building an XSD to validate a given xml, my issue is that some of the XML elements are of the form <ElementName description="i am an element">1234567</ElementName> I need to build the XSD that validates the Element 'value' not the attribute so with my increadibly limited experience in building XSDs (I've r...

Validate using one element of XSD in java

Hey! Is there any way to use an xsd file to validate input of a string? I have found some examples of xsd being used to validate an xml file, but what I really want is to just use one element of the xsd to validate some user input. Is there a simple way to do this or should I just treat the xsd file as an xml file, extract the element...

How to validate an xml file against an XSD Schema using Amara library in Python?

High bounty for the following Q: Hello, Here is what I tried on Ubuntu 9.10 using Python 2.6, Amara2 (by the way, test.xsd was created using xml2xsd tool): g@spot:~$ cat test.xml; echo =====o=====; cat test.xsd; echo ==== o=====; cat test.py; echo =====o=====; ./test.py; echo =====o===== <?xml version="1.0" encoding="utf-8"?>==; ....

XSD Problem: How to only restrict an element/attribute to be used under another schema

I need to solve this and looks like I need help. Here is the problem definition We have an existing schema X [X is an industry standard schema] for which we are building some extensions in a new schema Y (with a different target namespace]. Now the problem is we want to restrict usage of the elements/attributes of Schema Y to be onl...

How do I extend a base schema with custom elements while remaining open to change from new versions?

Given an XSD as follows: <xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:std="http://..." targetNamespace="..."> <xs:element name="SomeRootNode" type="std:SomeRootNodeType" /> ... </xs:schema> that defines some elements which allow any child from a dif...

what does "When <simpleContent> is used, the base type must be a complexType whose content type is simple..." mean?

heres the whole error I keep getting from xerces.... When is used, the base type must be a complexType whose content type is simple, or, only if restriction is specified, a complex type with mixed content and emptiable particle, or, only if extension is specified, a simple type. 'string' satisfies none of these conditions. I thought ...

cleaner extension of elements using XSD

I defined xml schema the contains an element called 'field' and an extension to it called 'composite-field'. it is defined as following: <xs:complexType name="field"> <xs:sequence> <xs:element name="value" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:complexType name="composite-Field"> ...

XSD any element any order any number of times

I have tried all the xs:all, xs:choice, and xs:sequence. Does anybody know how would you validate something like this. <Menu> <SubMenu> <MenuItem .. /> <MenuItem .. /> <MenuItem .. /> </SubMenu> <MenuItem .. /> <MenuItem .. /> </Menu> Where, Under the tags Submenu, MenuItem can ...