xsd

how to: re-assemble machine generated classes from xsd files to their original nested state.

Hi everyone, I'm working in Visual Studio 2008 using c#. Let's say I have 2 xsd files e.g "Envelope.xsd" and "Body.xsd" I create 2 sets of classes by running xsd.exe, creating something like "Envelope.cs" and "Body.cs", so far so good. I can't figure out how to link the two classes to serialize (using XmlSerializer) into the proper n...

DTD (or XSD) problem with duplicate name element having different scopes

Hello, I extracted a xml fragment on which I am working for a DTD, pratically I need a specific declaration for resource contained in tag resources and another different one for resource contained in tag input. The problem is that the first one requires the id attribute, the second one does not require the id attribute because uses alte...

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...

Interchange xsd and xsi in the output of XmlSerializer

XmlSerializer serializer = new XmlSerializer(typeof(IxComment)); System.IO.StringWriter aStream = new System.IO.StringWriter(); serializer.Serialize(aStream,Comments); commentsString = aStream.ToString(); Here the commentsString has the the following element in it <IxComment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:...

xml to xsd to c# class

Following this article link text one of the comments from 'zanoni' said he did it this way Using .NET 3.5: [XmlRoot] public class EmailConfiguration { [XmlElement] public string DataBoxID { get; set; } [XmlElement] public DefaultSendToAddressCollectionClass DefaultSendToAddressCollection { get; set; } } public class ...

xsd and wsdl incorrect file

How to fix corrupted xsd and wsdl files, is there any IDE which can suggest what is wrong? such as eclipse for java code when pressing CTRL + 1 , or where can I find books tutorials to understand formatting of these file types better? thank you Here is concrete message error I have [ERROR] 'item' is already defined line 223 of file:/...

XSD: minInclusive and attribute together

It seems I can't easily have an XSD declaration for this simple XML <root> <weekday name="Sunday">1</weekday> </root> where weekday is a restricted int from 1 to 7 and has a name attribute of type string Any advice? Thanks for your support! ...

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...

xs:choice unbounded list

I want to define an XSD schema for an XML document, example below: <?xml version="1.0" encoding="utf-8"?> <view xmlns="http://localhost/model_data" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://localhost/model_data XMLSchemaView.xsd" path="wibble" id="wibble"> <text name="PageTitle">Homepage</text>...

XSD any element

HI! I'm trying to create a list that some of the elements are defined and some are not, without priority to order. I tried it this way, with an any element: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; <xs:complexType name="object" mixed="true"> <xs:choice> <xs:element name="value" minOccurs="1...

Creating a 'flexible' XML schema

I need to create a schema for an XML file that is pretty flexible. It has to meet the following requirements: Validate some elements that we require to be present, and know the exact structure of Validate some elements that are optional, and we know the exact structure of Allow any other elements Allow them in any order Quick example...

Schema generated from WCF web service and ASMX are different

I have the following class [Serializable()] [XmlType(AnonymousType=true)][XmlRoot(Namespace="", IsNullable=false)] public class Test { [XmlAttribute()] public string Prop { get; set; } public string Another { get; set; } } I used this class in both a WCF web service (SVC) and an ASMX web service and I'm expectin...

Defining xml in an xsd where an attribute determines the possible contents

How would one go about defining something like this in an xsd? <start> <request type="typeA"> <elementOnlyFoundInA /> </request> <request type="typeB"> <elementOnlyFoundInB /> </request> </start> I ran xsd.exe just to get an idea of what it might look like, but it does not appear recognize the relations...

XSD file, where to get xmlns argument?

<?xml version="1.0" encoding="utf-8"?> <xs:schema id="abc" targetNamespace="http://schemas.businessNameHere.com/SoftwareNameHere" elementFormDefault="qualified" xmlns="http://schemas.businessNameHere.com/SoftwareNameHere" xmlns:mstns="http://schemas.businessNameHere.com/SoftwareNameHere" xm...

Generate annotation along with schema from class

Hi, Do you know if we can add comments in the class and when we generate schema from it using xsd.ece, it should place annotations in the schema> ...

DataTable ReadXmlSchema and ReadXml Resulting in error

I'm having some trouble with the ReadXmlSchema and ReadXml methods for a DataTable. I'm getting the error "DataTable does not support schema inference from Xml". Code Snippet: I've tried Table.ReadXmlSchema(new StringReader(File.ReadAllText(XsdFilePath))); Table.ReadXml(new StringReader(File.ReadAllText(XmlFilePath))); And Table.Re...

XSD data set with Oracle database

Hi folks, I'm having a major issue with an XSD dataset mapping thingy that I'm using within my current project. We are using XSDs for some data abstraction (it's quicker and debatably more maintainable that using Parameterised SQL or a StoredProc), and on my machine (running in the VS development environment) thy're working fine. Howe...

Is there a way to export an XSD schema from a DataContract

I'm using DataContractSerializer to serialize/deserialize my classes to/from XML. Everything works fine, but at some point I'd like to establish a standard schema for the format of these XML files independent of the actual code. That way if something breaks in the serialization process I can always go back and check what the standard sch...

Question regarding XML validation using XSD

I am looking to create an XSD document that would validate some XML for me. Let's say, for example, that the XML documents are designed to describe books: <?xml version="1.0" encoding="UTF-8"?> <book> <comment>Bob's very first book</comment> <name>Bob's book</name> <author>Bob</author> <year>2009</year> <publisher> ...

How can I 'validate' that an XML file is correctly using the .xsd file I set for it?

I'm new to XML validation using .xsd files. Maybe I'm not even asking the correct question here; but is there a way for the computer to tell me that 'Yeah, your XML file is correctly formatted according this .xsd file you made'. I imagine I need a validator of some sort. Do those exist and it that what I need? ...