473,395 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

XMLSerialzer class

Hi

I am trying to use XMLSerialzer class to generate serializable class for
following schema.

<xs:element name="KeyIdentifiers" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="KeyIdentifier" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="KeyIdentifierField" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

After generating class using xsd.exe I see following code in generated class

class GObject
{
.....
.....
public GObjectEntityKeyIdentifiersKeyIdentifier[][] KeyIdentifiers;
.....
......
}
Now when I try to create XMLSerialzer object function fails.

XmlSerializer xs = new XmlSerializer(typeof(GLibrary.GObject));
When I checked intermediate .cs file generated bu XMLSerializer then I found
following line due to which compilation fails resulting in failure of
XMLSerialzer creation.

Write13_GObjectEntityKeyIdentifiersKeyIdentifier(@ "KeyIdentifier",
@"http://Genie.org/Entity.xsd",
((GLibrary.GObjectEntityKeyIdentifiersKeyIdentifie r)a[ia]), false, false);

It seems source generation of XMLSerializer does not handle two dimensional
arrays correctly because when I remove maxOccurs="unbounded" from
KeyIdentifiers element then everything works fine becuase then it is only
single dimension array.

Regards


Nov 11 '05 #1
1 1520
Can you post a schema and code that shows the error? A small test case is
best.
The fragment you posted isn't a complete schema, something is missing.

Also,
Adding the NestingLevel=1 attribute to the jagged array may fix the problem.

Consult the archives for more details.

-Dino
"tushar" <ta******@hotmail.com> wrote in message
news:ud**************@TK2MSFTNGP11.phx.gbl...
Hi

I am trying to use XMLSerialzer class to generate serializable class for
following schema.

<xs:element name="KeyIdentifiers" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="KeyIdentifier" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="KeyIdentifierField" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

After generating class using xsd.exe I see following code in generated class
class GObject
{
....
....
public GObjectEntityKeyIdentifiersKeyIdentifier[][] KeyIdentifiers;
....
.....
}
Now when I try to create XMLSerialzer object function fails.

XmlSerializer xs = new XmlSerializer(typeof(GLibrary.GObject));
When I checked intermediate .cs file generated bu XMLSerializer then I found following line due to which compilation fails resulting in failure of
XMLSerialzer creation.

Write13_GObjectEntityKeyIdentifiersKeyIdentifier(@ "KeyIdentifier",
@"http://Genie.org/Entity.xsd",
((GLibrary.GObjectEntityKeyIdentifiersKeyIdentifie r)a[ia]), false, false);

It seems source generation of XMLSerializer does not handle two dimensional arrays correctly because when I remove maxOccurs="unbounded" from
KeyIdentifiers element then everything works fine becuase then it is only
single dimension array.

Regards


Nov 11 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Murat Tasan | last post by:
hi, i am having a small problem with constructing an inner class. i am using an inner class (and not a static nested class) because the methods of the inner class need access to the enclosing...
2
by: Fernando Rodriguez | last post by:
Hi, I need to traverse the methods defined in a class and its superclasses. This is the code I'm using: # An instance of class B should be able to check all the methods defined in B #and A,...
2
by: Gabriel Genellina | last post by:
Hi In the following code sample, I have: - a Worker class, which could have a lot of methods and attributes. In particular, it has a 'bar' attribute. This class can be modified as needed. - a...
1
by: Oplec | last post by:
Hi, I'm learning C++ as a hobby using The C++ Programming Language : Special Edition by Bjarne Stroustrup. I'm working on chpater 13 exercises that deal with templates. Exercise 13.9 asks for me...
9
by: Banaticus Bart | last post by:
I wrote an abstract base class from which I've derived a few other classes. I'd like to create a base class array where each element is an instance of a derived object. I can create a base class...
5
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits...
3
by: Hamilton Woods | last post by:
Diehards, I developed a template matrix class back around 1992 using Borland C++ 4.5 (ancestor of C++ Builder) and haven't touched it until a few days ago. I pulled it from the freezer and...
0
by: emin.shopper | last post by:
I had a need recently to check if my subclasses properly implemented the desired interface and wished that I could use something like an abstract base class in python. After reading up on metaclass...
0
by: =?Utf-8?B?a3Jpc2huYQ==?= | last post by:
Hi i am getting the following error while using XMLSerializer XmlSerializer ser = new XmlSerializer(typeof(Person)); ERROR: Unable to generate a temporary class (result=1). error CS0266: Cannot...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.