xsd.exe bug or odd xsd file

I was given a couple of XSD files so that I could generate a client that 
targeted a SOAP/RPC web service.  One of the XSDs includes a definition of an 
element that is a sequence of row elements, which in turn is defined as a 
sequence of column elements.  

The CS class file generated defines the sequence of row elements "rows as 
column() ()" rather than "row() As row".  This seems to give trouble to 
XmlSerializer.

With XmlSerializerPreCompiler I was able to narrow the problem down and 
guess at the problem.  I made the change that I indicated above because this 
seems to be "in the spirit" of the schema definition and what I would have 
expected.

Does it make sense for XSD.EXE to skip the intermediate definition of "row" 
and make the rows a two-dimensional array of columns?  Why couldn't 
XmlSerializer deal with this?


I'll try to get this down to a minimum reproducible xsd and class file, but 
I wonder if I can get a sanity check on this given this little bit of 
information.

Thanks.

-- 
Peter Kryszak
TeleCommunication Systems, Inc.
0
9/7/2005 9:34:49 PM
dotnet.xml 7266 articles. 0 followers. Follow

4 Replies
679 Views

Similar Articles

[PageSpeed] 30

Hello!


> I'll try to get this down to a minimum reproducible xsd and class file, but 
> I wonder if I can get a sanity check on this given this little bit of 
> information.

A bit of code would be nice (especially the XSD) as there are a lot of 
ways to describe your Schema in XSD and xsd.exe seems not to understand 
all of them.


-- 
Pascal Schmitt
0
9/8/2005 12:48:18 AM
Here's the XSD:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.vendor.com/Schema/subsys" 
	xmlns:subsys="http://www.vendor.com/Schema/subsys" 
	xmlns:xs="http://www.w3.org/2001/XMLSchema" 
	elementFormDefault="qualified" 
	attributeFormDefault="unqualified">


	<xs:element name="messageWrapper">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="subsys:header" minOccurs="0"/>
				<xs:element ref="subsys:rowsOfColumns" minOccurs="0" maxOccurs="1"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="header1" type="xs:string"/>
	<xs:element name="header">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="subsys:header1" minOccurs="0"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>


	<xs:element name="rowsOfColumns">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="type" type="xs:string"/>
				<xs:element ref="subsys:row" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<xs:element name="row">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="subsys:column" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<xs:element name="column">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="subsys:name"/>
				<xs:element ref="subsys:value"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<xs:element name="name" type="xs:string" />
	<xs:element name="value" type="xs:string" />
	
	</xs:schema>
	
	
0
9/8/2005 1:58:03 PM
Here's the cs file.  Note that rowsAndColumns is made up of a two-dimensional 
array of columns rather than a one dimensional array of rows, which would in 
turn be made up of a one dimensional array of columns.  I would have expected 
the latter.

//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.1.4322.2032
//
//     Changes to this file may cause incorrect behavior and will be lost if 
//     the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------

// 
// This source code was auto-generated by xsd, Version=1.1.4322.2032.
// 
using System.Xml.Serialization;


/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.vendor.com/Schema/subsys")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.vendor.com/Schema/subsys", IsNullable=false)]
public class messageWrapper {
    
    /// <remarks/>
    public header header;
    
    /// <remarks/>
    public rowsOfColumns rowsOfColumns;
}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.vendor.com/Schema/subsys")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.vendor.com/Schema/subsys", IsNullable=false)]
public class header {
    
    /// <remarks/>
    public string header1;
}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.vendor.com/Schema/subsys")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.vendor.com/Schema/subsys", IsNullable=false)]
public class column {
    
    /// <remarks/>
    public string name;
    
    /// <remarks/>
    public string value;
}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.vendor.com/Schema/subsys")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.vendor.com/Schema/subsys", IsNullable=false)]
public class rowsOfColumns {
    
    /// <remarks/>
    public string type;
    
    /// <remarks/>
    [System.Xml.Serialization.XmlArrayItemAttribute(typeof(column), 
IsNullable=false)]
    public column[][] row;
}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.vendor.com/Schema/subsys")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.vendor.com/Schema/subsys", IsNullable=false)]
public class row {
    
    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute("column")]
    public column[] column;
}

0
9/8/2005 2:00:02 PM
Thanks for looking into this.  This xsd and cs code reflects what I saw in 
the real files.

The error is in the serialization.  I get the file not found error for the 
temporary DLL.  I can see the exact problem using 
XmlSerializationPreCompiler.  It shows the compiler error CS0030: Cannot 
convert type ...column[] to ....column.

BTW, what a revelation to see how serialization is done; generating 4000 
KSLOC on the fly to turn an instance into XML text. That has serious 
implications.  There has to be a better way.  ASN.1 maybe?
0
9/8/2005 2:27:08 PM
Reply:

Similar Artilces:

trouble validating against xsd
Hello, I have an xsd file that I'm trying to use to validate some xml against. I'm hoping this is a simple problem, but I just don't see it. I get the error "The 'role' element is not declared." when trying to validate this xml: <users> <user id="jon" pwd="pass"> <roles><role>Admin</role></roles> </user> </users> Against this schema: <?xml version="1.0" encoding="utf-8" ?> <xs:schema elementFormDefault="unqualified" xmlns="" xmlns:xs=&...

Disable password protection on .pst files
Just wondering if there is a registry key change or something I can do using the orktools that will prevent users from applying passwords to their .pst files. This is at the request of our legal department who is concerned that users may leave and their case files and such are now inaccessible to everyone. Thanks! Mary Patricia <rodgers.patricia@> wrote: > Just wondering if there is a registry key change or something I can > do using the orktools that will prevent users from applying passwords > to their .pst files. This is at the request of our legal department > who is ...

Why has file size jumped in an Excel workbook?
I have an excel workbook that started as 148kB and is now 2.6MB, but the size increase is for no apparent reason, I'm not aware of doing anything other than forwarding it by email to a colleague. When I check one of the sheets it shows the last cell to be at row 27364 even though there is nothing beyond row 26, but I can't seem to clear the range. There are no spurious characters that I can see, what have I done? I had this happen when I accidentally applied a format change to the entire worksheet. Try selecting the entire worksheet, select edit/clear.../formats. Good luck,...

import .QIF-file with category information
I'm trying to import a QIF-file with transaction-information. The import completes succesfully, but I cannot find any category information. Does anyone knows a solution ? Regards, Arthur ...

Open Excel file with command button?
We have two versions of MS Office installed in our office � 97 & 2003 We use Access 97 and Excel, Word and PowerPoint 2003 The file types are associated with the correct programs, so double clicking an Excel file for example will open it using Excel 2003. I have an Access 97 db with a command button on the form that when clicked opens an Excel file using the FollowHyperlink code.E.g. followhyperlink � \\servername\shared\PUBLIC\filename.xls� I have also tried to enter the hyperlink on the format tab on the property sheet On both occasions the file opens with Excel 97 Is there...

Mapisp32.exe
When doing send and receive in outlook 97 Mapisp32 goes up to 99% on the cpu usage and outlook appears to hang. Office 97 in running on windows XP using internet mail. Any help would be much appreciated aidan wrote: > When doing send and receive in outlook 97 Mapisp32 goes up to 99% on > the cpu usage and outlook appears to hang. Office 97 in running on > windows XP using internet mail. > > Any help would be much appreciated Not sure if this will help, but see http://www.slipstick.com/addins/SERVICES/imep.htm Also note - OL97 is old, unsupported, and was buggy at rele...

About XSD Parser
Hello, I have a XSD file which has the following format: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com" xmlns="http://www.w3schools.com" elementFormDefault="qualified"> <xs:element name="note"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/> <xs:element name="from" type="xs:string"/> <xs:element name="heading&q...

File opening problem over network
I have what seems to be a strange excel file opening issue that I can't pinpoint and I would greatly appreciate any ideas to try for this problem. We have a network computer running windows 98 SE. On this computer there are many .xls files stored for users to access. Often when opening the files users get an error that reads: Microsoft Excel cannot open or save any more documents because there is not enough available memory or disk pace. -To make more memory available, close workbooks or programs you no longer need. -To free disk space, delete files you no longer need from the disk yo...

Entity XSD schemas are invalid
Hi, As part of doing a custom integration using BizTalk 2004, we need to do mappings between MS CRM and other applications. However the xsd's provided with the SDK and the stored procedures generating them are/produce invalid (non-w3c compliant) xsd. It might be an idea for someone in the MS CRM dev group to go over these xsd's with a validator and fix the incorrect sections, including th generating stored procedures so updated schemas can be made available for integration purposes. Best Regards Thomas Scheelhardt I have found the majority of examples in the SDK are incorrect an...

Ignoring Elements in XSD
How do I write a schema that is only validating elements: 1,4,7,8,9 and ignores every other element? I also need to not to care about the order of the elements or how many are in between elements that I am trying to validate. XML: <root> <element1 /> <element2 /> <element3 /> <element4 /> <element5 /> <element6 /> <element7 /> <element8 /> <element9 /> </root> XSD: <xs:element name="root"> <xs:complexType> ...

Bug: printing of a specific page range is broken in MFC-VS2005
If you create an MFC application that includes printing support, and your application does print-time pagination as described in this MSDN library topic: http://msdn2.microsoft.com/en-us/library/w7wzay73(VS.80).aspx then specifying printing of a specific range of pages in the print dialog does not work. The application always prints all pages of the document. To see this problem download and build the WordPad sample MFC application. Start a new blank document, then paste into it enough text to fill several pages. Choose Print from the File menu. Choose a print range of page 1 to page 1....

C:\Programfiles(x86)\Microsoft Office\Office 12\winword.exe
I am having trouble with little white boxes containing red x's. I suddenly cannot see any pictures when I use the print screen. I get to word and paste and a blank box comes up. I have reinstalled checked for viruses etc... Sometimes when I log off it says "You are missing a component." C:\Programfiles (86)\Microsoft Office\Office 12\winword.exe I am going crazy as I need this to work. I am also having trouble with websites and little white boxes with red x's. I cannot download the flash player whereas before I did not have this problem. Any help would b...

MIDL.exe , where is it stored in VC7 ?
Hi, What is the path of MIDL in VC7 Thanks, sandSpiderX Hallo sandSpider! > What is the path of MIDL in VC7 Here: C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\Bin -- Martin Richter [MVP] WWJD "In C we had to code our own bugs. In C++ we can inherit them." FAQ : http://www.mpdvc.de Samples: http://www.codeguru.com http://www.codeproject.com Hi Martin, Thanks a lot... ...

move files and folers option
I had to perform recovery on my computer and after doing so, when I right click on a file or folder the option to move or copy to is gone. I cannot move files or folders from another location. Also cannot transfer from cd or flash drive to computer. Thanks in advance for any help you can give me! On Mon, 22 Feb 2010 13:56:01 -0800, B.J. <BJ@discussions.microsoft.com> wrote: > I had to perform recovery What does "perform recovery" mean? Exactly how did you do this? > on my computer and after doing so, when I right > click on a file or folder ...

how to edit Adobe file
how to edit Adobe file Most certainly not in Word. pdf files, I'm assuming that is what you mean by 'Adobe files', are 'fixed' files. Their layout is frozen so they look the same on any machine and can not be edited. If you still want to edit such a pdf file, you will have to convert the file to something else, edit it, and then save the result back as a pdf. The best tool to do the conversion of pdf files to Word documents is probably Acrobat Professional. Unfortunately, that is a rather expensive product to use for a few simple conversions. There are ...

q) Can pivot page filed represent hierarchy ?
q) Can pivot page filed represent hierarchy ? Hi, Pivot Table Page Fields filter function is not dependent each others. I want to filtering like hierarchy. A hierarchy is a system of organizing people into different ranks or levels of importance, for example in society or in a company. for example, pivot's page field have three columns: address1, address2, address3 address1 is State address2 is City address3 is Street therefore add1 > add2 > add3 Address1 is filtered by a item and click addrss2's filter button address2's itemlist is not filtered by address1's...

can't repair my PST file with scanpst.exe
Hi, I am using outlook 2003, and my outlook have some problem its having 2 GB of data and i am try to repair with Scanpst.exe but it says the error that the file is too large and unable to repair the PST. Please help me to get off this problem. Thanks in Advance. Balaji.k See if the info here helps: http://www.slipstick.com/problems/repair2gbpst.htm "balaji" <balajek_hwe@hotmail.com> wrote in message news:eg0zfjcIGHA.3144@TK2MSFTNGP10.phx.gbl... > Hi, > > > I am using outlook 2003, and my outlook have some problem its having 2 > GB of data an...

Newprof.exe
I have an issue when using Outlook 2002. When I sign on to my laptop (using Domain credentials) I get an error from outlook about the profile generator. In the Event Viewer, I see the following: Description: Faulting application newprof.exe, version 5.5.3121.0, faulting module ntdll.dll. version 5.1.2600.1217, fault address 0x0000b2ab I have tried multiple uninstall/reinstalls and mulitple "Detect and repair" with no effect. ...

using embedded .xsd vs file based .xsd
I am thinking of embedding my schemas as embedded resources instead of reading it using URI at run-time. I came across some snags while trying to do just that such as, previously unknown to me, XmlValidatingReader.Schemas.Add was using XmlValidatingReader.Resolver to resolve my schemas using the URI method. Resolver property was never set, so the reader simply ignored any external references even though one of the schema explicitly imports the other one. I verified this by removing the referred schema from the schema collection, and the code chugged along fine. But when I changed the code to ...

will not write file to server
when i try to do save as to my nevell server i get them message file is read only. there is a hot fix for this but i don't know how to get it can someone help thanks pete The MSKB article that discusses this problem: http://support.microsoft.com/default.aspx?scid=kb;[LN];824424 suggests ways to contact MS. I don't know of any other ways. -- Jim Rech Excel MVP ...

Create filtered dataset from XML file?
I need to create a Dataset and datatable from an XML file. The only way I know how to make a Dataset and Datatable, is by using an Access database as my datastore: You know, the usual thing in all the books; an OleDbDataAdapter, with a SQL string and connection. How can I do this using an XML file instead of an Access table? I know I can convert an XML file straight into a Dataset. But the dataset always contains ALL the info from the XML file. I want the dataset to be filtered by using some sort of query. A couple years ago I hurt my brain figuring out Xpath. Boy, i'm just not mea...

Updating Excel Files
I am a novice user of excel and need a little help. I am using spreadsheet to update my websites inventory levels. I receive a inventory update file from my supplier once a day. The problem is don't sell all of the items in that file. eg My File 1 ---- Suppliers File BDDTTH ---- 100001 BDGBB ---- 100011 BDGCJ ---- 1099211 BDGJCS ---- BDGJCS BDGJGL ---- BDJGL BDLB-BD38 ---- BDDTH What I need to do is compare the part numbers and if I get a matc update the inv...

Can I save application as .exe file
I have created several successful Access applications in the past. I need an application that can be maintained on several different computers which may not all have MS Office installed. Can I put the complete database on a CD so different people can update the data? I guess that this means the application would have to be a .exe file and maybe use CD-RW CDs so it can be written to on different computers. Really Gone There's never been an ability to create an executable from an Access database, and I wouldn't expect there ever to be such a capability. Take a look a...

I want a mesage sent when a change is made to an excel file
I have created a spreadsheet in excel for keeping track of stock we hold. When a customer request a call off from stock the customer contact will enter the information onto the spread sheet. I want to be able to create a message and send it to the despatcher, notifying him of the call off request, with as little work as possible. Charlie, This code requires a reference to MS Outlook - in the VBE, choose Tools / References, and check the box next to outlook In a regular module, put this code: Option Explicit Public OldValue As Variant Public NewValue As Variant Public strChanges As Str...

Problems with XML, XSD, Web, Services & InfoPath
Hi all, Have been playing about with web services but unable to achieve what I am wanting and in attempts finding strange problems. I have created a web service for retrieving customer data and for updating the data using datasets. I have created a XML schema. I decided to use InfoPath for testing things out. Works great for getting the data. The data table on SQL Server 2000 allows nulls. If I was to change this I would have to split my customers into 2 tables. The table allows customer details to be stored as an individual or organisation. As a result some fields don't require ...