xsd

XML Schema: Make the value of a multiple occuring tag unique

Hello, I have this XML pattern... <module> <promo> <day>1</day> <day>2</day> </promo> <promo> <day>3</day> <day>4</day> </promo> <promo> <day>Default</day> </promo> </module> I would like to stop users putting the same value into 2 <day> tags anywhere in the <module> tag. I can current...

XML - Data At Root Level is Invalid

I have an XSD file that is encoded in UTF-8, and any text editor I run it through doesn't show any character at the beginning of the file, but when I pull it up in Visual Studio's debugger, I clearly see an empty box in front of the file. I also get the error: Data at the root level is invalid. Line 1, position 1. Anyone know w...

What is a good tool to document XSD <---> XSD schema mapping?

Is there a tool that lets you open one schema on the left, the other schema on the right, and document the element-level mapping between them. ...

How do I set a minimum length for an integer in an XML Schema?

I am in the process of creating an XML Schema and one of my values is a year. As such, I'd like to ensure that all values have exactly 4 characters. To do so, I am using the following syntax: <xs:element name="publish_year" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:positiveInteger"> <xs:totalDigits value="4"/...

Generate class for schema with abstract complex type

I'm working with some schema which defines an abstract complex type, eg. <xs:complexType name="MyComplexType" abstract="true"> This type is then referenced by another complex type in the schema: <xs:complexType name="AnotherType"> <xs:sequence> <xs:element name="Data" type="MyComplexType" maxOccurs="unbounded"/> </xs:sequence...

XML instance generation from XML schema (xsd)

I was wondering if there's a way I can automate the generation of XML files from XSD schemas given that I have the data and the labels. I'd like to do this in python/java. It seems very possible, yet I can't find any library that allows me to do this. I'm looking for a fairly quick solution.. Any ideas? See also: how-to-generate-samp...

Generate .Net objects from known XSD

I have some XSD-s that define my objects hierarchy. for example math.xsd, base.xsd while math.xsd is depends on base.xsd. I need to generate classes from those xsd-s. I've already read about those two tools: CodeXS tool and XSD.exe. the problem with the xsd.exe is that I didn't succeed generating classes from two xsd-s that depends on...

XSD validation for unsorted and only one unbounded item

I have a xml file like this: <customer> <field1 /> <field2 /> <field3> <item1 /> </field3> <field3> <item1 /> </field3> </customer> field* can appear in any order and only field3 can appear more than once. How can I create a XSD file to validate this? Thank you! ...

Found unexpected <Submission> inside <<<<ROOT>>>>. This is not a valid child element

I am trying to validate xml file against schema using XML::Validator::Schema. But it gives me this error: Found unexpected <Submission> inside <<<<ROOT>>>>. This is not a valid child element. [Ln: 2, Col:119] Note: <Submission> is the very first element I have after <xml version="1.0" encoding="UTF-8"?> I can't figure out what it ...

Restrict exclusive key-value pairs in XSD

In the XSD, there are two elements, A and B. They are siblings. A can have a value of either "1" or "2". B can have a value of either "one" or "two". I want to restrict this, however, so that only "1-one" and "2-two" are valid combinations, not "1-two" or "2-one". Is there a way of doing that in the XSD? ...

xsd pattern restriction - disallow backslash

I have a requirement to disallow backslash characters in a given string field defined by an xsd document. However, being as green as I am, I am not confident with my xsd and/or regex knowledge. Here is what I have so far: <xs:simpleType name="BackslashRestrictedField"> <xs:restriction base="xs:string"> <xs:minLength value="0" />...

Can I have one XML-Schema (XSD) include another XML-Schema?

I currently have two XSD schemas and one is a "light" version of the other. Right now I have everything in the "light" version repeated in the "complete" schema, but this becomes a pain when I need to make a change, and it goes against the DRY principle anyways, so I was wondering if there was an element that served to include another sc...

XML schema contruct for a type with both enumerations and attributes

I'm trying to create a type in an XML schema to enforce an element with both: A single attribute; and Simple content matching an enumeration. In an XML document, the element might look like: <Operator Permutation="true"> Equals </Operator> Where "Equals" would be one of the enumerations. Is this possible? If so, how? I've trie...

How modular should be a XML schema?

Hello everyone! Talking about schema definitions, what are you used to doing: put everything inside a unique and big bang XML schema? use a domain modularization approach, putting all entities that referes to the same context together? or just use a schema per entity? I´ve read in a best practice document from a famous/private integ...

An XSD to describe XSDs

I have an application into which users can upload an XSD to describe certain kinds of user data. The application needs to parse this XSD to correctly initialise various bits of database metadata (e.g. translating xs:enumerations into lists of permitted values that will populate drop-down lists). The same user-entered XSD is also used to ...

XSD validation

Can anybody help me to build an XSD file to validate XMLs like these: [test] [a/] [b/] [a/] [b/] [/test] [test] [a/] [a/] [b/] [/test] Basically, I can have any number of and/ or nodes, without any other rule (can't use ). Thanks. ...

Assign connection string to table adapter from session

My application is already developed and now we are going to change the connection string whatever stored in the session object (Bcoz of Distributed Database Management System (DDBMS)) Problem is here..... In that application There are so many **ObjectDataSource** which are initialize with the using .XSD file. which is related ...

Looking for an XSD representing an 'Order' for a shopping cart

I am trying to create an XML schema representing an 'order' for a shopping cart I want this to completely abstract away my shopping cart's implementation -- and eventually support partners sending us orders using this schema. (yes i'm planning on integrating this schema into our existing cart) It will have original order items, repeat ...

How can I generate multiple classes from xsd's with common includes?

Aloha I received a few nice xsd files which I want to convert to classes (using xsd.exe) All the xsd's have the same includes, like this: <xs:include schemaLocation="kstypes.xsd" /> <xs:include schemaLocation="ksparams.xsd" /> When I generate a class for each xsd the types declared in these files are duplicated for each original xsd....

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 that looks like this: <option value="test">sometext</option> I can't figure out how to define an element that is of type "xs:string" and also has an attribute. I'm fairly new to writing XML schemas, so please bear with me! Here's what I've g...