xml-schema

Xsd recursion of complexTypes

I am just learning XML/XSD and am struggling with the implementation of an XML-schema which models a folder structure. What I had in mind was defining a complexType for the folder which can have additional folder instances that represent subfolders. Using the xsd schema validator here always returns that the schema is invalid. I tried ...

I need multiple xmlns elements in an element with the XmWriter

I'm trying to convert a xml document from one format to another and while doing this I've found that I need to insert multiple xmlns declarations to the root element. Example: <?xml version="1.0" encoding="utf-8" ?> <Template xmlns="http://tempuri.org/TemplateBase.xsd" xmlns:TYPES="http://tempuri.org/TemplateTypes.xsd"&gt; some con...

xsd:choice on 'unconnected' elements

I have an xml that comes in two forms <root> <element1 req="mandatory"/> <element2/> <element3/> <root> and <root> <element2/> <element3/> <element4 req="mandatory"/> <root> element1 or elem4 is req'd 2 and 3 are optional. I just cant figure out how to use a xsd:choice on it, help, thanks. ...

C++ tool to generate random XML files from XML Schema ?

I think there should be a tool to do so ? is anyone here aware of any ? I saw other posts related to this but found none for C++, I am aware that I can do that with JAVA and C#. ...

Translate XSD element names to English

I have an XML Schema Definition file .XSD who's elements are in Spanish. I have an XML data file that is also in Spanish that matches the schema definition. I created a dataset from the xsd using xsd.exe and I'm loading the XML into the dataset. I want to translate the element names to English. I can think of two options off the top of...

XSD Restrictions based on target xml elements

Is it possible in xsd to create restriction based on elements of some type in target (processed) document? For example I have XML like this: <Pets> <Pet name="Murka" /> <Pet name="Browko" /> <Pet name="Tuzik" /> </Pets> <Children> <Child name="Petruk" favoritePet="Browko" /> </Children> so what I want to restrict the attribute "...

Specify XML schema data type of decimal or blank

Is there a way in an XML schema to specify that an element may contain either an empty string or a decimal? If I specify the type as xs:decimal like this: <xs:element name="Sample" type="xs:decimal" /> then a blank value would not pass validation: <Sample/> (I realize that the best way to indicate no value would be to not include ...

Defining recursive algebraic data types in XML XSD

Imagine I have a recursive algebraic data type like this (Haskell syntax): data Expr = Zero | One | Add Expr Expr | Mul Expr Expr I'd like to represent this in XML, and I'd like an XSD schema for it. I have figured out how to achieve this syntax: <Expr> <Add> <Expr> <Zero/> </Expr> <...

XML Schema to restrict one field based on another

I have the following schema, which I use to ensure that a person's PhoneNumber and PhoneNumberType (Home, Work, etc.) is not longer than 10 characters. However, I want to improve this schema so that PhoneNumberType is not required if a PhoneNumber is not provided, but is required if the PhoneNumber is provided. Is there a way to do this ...

C# Help: Adding a complexType to the main XmlSchema

I need to create program that creates a XML schema like below using System.Xml.XmlSchema namespace I'm using the XmlSchemaComplexType to MyString and MyInteger but I can't seem to find a way to set the extension to base string and int respectively. Any guidance is much appreciated ... thanks <?xml version="1.0" encoding="utf-8" ?> <xs...

how to specify in xml schema that either one of two fields must be present?

i want to specify that either fieldname or freetext is always present in xml files that apply to xsd. is there a way to define it? <xs:complexType name="tSome"> <xs:sequence> <!-- either of 2 below have 2 be present. --> <xs:element name="fieldname" type="xs:string" /> <xs:element name="freetext" type="xs:string" /> <xs:element...

XML Schema: Restricting the valid type of an element to a subset of types derrived from an abstract type

I have the following type structure: Foo (abstract) Bar extends Foo Baz extends Foo Bar1 extends Bar Baz1 extends Baz I have two elements I'd like to restrict the types of: Is this possible in XSD? ...

Enumeration of a complex type

How can I make an enumeration of a complex type? For example, I want to store the following data into a xsd enumeration called Measurings description tag item item tag fileName each one of these attributes has an specific value and this set makes one registry in my ennumeration. But the problem is that as far as I know, it's allo...

XmlSchemaElement type

Hi, I'm generating WSDL of my web service dynamically, but when I set the XmlSchemaType of my elements, the ServiceDescriptor writes the element as an element rather than message, as I need. The code looks like this: XmlSchemaElement schemaElement = new XmlSchemaElement(); XmlSchemaComplexType complexType = new XmlSchemaComplexType();...

Working with .NET Project Files and Schemas?

I'm working on a project that will require me to take various .vbproj and .csproj files and determine which version of Visual Studio they were built with and then to get information such as the output dll name etc. Does anyone know if there is a schema available for these files? Google and MSDN searches are coming up a bit blank. Visu...

Runtime binding of XML Schema to Java code

Hi all, The situation is thus: I have an application which provides editing capabilities to XML an file. This file follows a certain Schema. The Schema belongs to a subset of Schemas which actually follow a line of evolution from one to another - so they are not so different from one another. The main difference between the schemas is...

Stop node containing subnodes and text in schema

If I have some xml like this: <mynode> <mysubnode> <mysubsubnode>hello world</mysubsubnode> some more text </mysubnode> </mynode> As you can see, mysubnode contains both a subnode and some text data. What I want to know is, is it possible to prevent this happening in a schema? I don't want nodes to contain sub...

xml2owl converting

is there any tool that can help me to convert an xml schema(product.xsd) to owl format ...

Schema Inheritance in BizTalk Server

Hi, I just wondering if anyone has already tried of doing something like schema inheritance in BizTalk schemas? I am using WCF Adapter and using 'consume adapter service' to generate a schema automatically, what I wanted is instead of always generating a schema and since most of my schema is the same then I want to have something like ...

Describe repeating XML nodes in W3C XML Schema?

I have an XML document like: <Root> <Bravo /> <Alpha /> <Charlie /> <Charlie /> <Delta /> <Foxtrot /> <Charlie /> </Root> The order of the nodes does not matter. Each node may appear zero or one times, except for Charlie. Charlie may appear zero, one, or arbitrarily many times. The straightforward way to ex...