473,795 Members | 3,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Defining a type that works like the types that support XmlArrayAttribu te

Hi,

I'm trying to support a 3rd-party XML format for which there is no
schema. As such, I've been making my objects that map to their format
using the XMLSerializer.. . but there's one object that stops me.

We have a class called Abstract-A, and a collection of Abstract-As
we'll call A-List. One particular subtype of AbstractA is bothering
me, because it works like this:

<AList>
<D foo="foo" bar="bar"/>
<G foo="foo">quux</G>
<B>
<B-Child foo="foo"/>
<B-Child foo="bar"/>
</B>
</AList>

As you can see, the problem is B-child. I define AList as a list of
Abstract-A's, and D, G, and B as subtypes of Abstract-A. But B is a
list of B-Childs. I tried defining B's "XmlText" member as being a
list of B-Childs, but you can only apply XmlText to strings (or arrays
of strings).

Any help would be appreciated.

Feb 23 '07 #1
2 1284
On Feb 23, 12:24 pm, "Martin Z" <martin.zar...@ gmail.comwrote:
Hi,

I'm trying to support a 3rd-party XML format for which there is no
schema. As such, I've been making my objects that map to their format
using the XMLSerializer.. . but there's one object that stops me.

We have a class called Abstract-A, and a collection of Abstract-As
we'll call A-List. One particular subtype of AbstractA is bothering
me, because it works like this:

<AList>
<D foo="foo" bar="bar"/>
<G foo="foo">quux</G>
<B>
<B-Child foo="foo"/>
<B-Child foo="bar"/>
</B>
</AList>

As you can see, the problem is B-child. I define AList as a list of
Abstract-A's, and D, G, and B as subtypes of Abstract-A. But B is a
list of B-Childs. I tried defining B's "XmlText" member as being a
list of B-Childs, but you can only apply XmlText to strings (or arrays
of strings).

Any help would be appreciated.
I've tried a few things more so far, still with no success:
1) XmlText, mentioned above.
2) Multiple XMLElement members (one for each element in the array -
horrible klude idea) - didn't work.
3) Implementing IEnumerable - might've worked, but the XmlSerializer
no longer considers my type B to be a subtype of Abstract-A, so it
can't be used in the AList.

Feb 23 '07 #2
On Feb 23, 12:24 pm, "Martin Z" <martin.zar...@ gmail.comwrote:
Hi,

I'm trying to support a 3rd-party XML format for which there is no
schema. As such, I've been making my objects that map to their format
using the XMLSerializer.. . but there's one object that stops me.

We have a class called Abstract-A, and a collection of Abstract-As
we'll call A-List. One particular subtype of AbstractA is bothering
me, because it works like this:

<AList>
<D foo="foo" bar="bar"/>
<G foo="foo">quux</G>
<B>
<B-Child foo="foo"/>
<B-Child foo="bar"/>
</B>
</AList>

As you can see, the problem is B-child. I define AList as a list of
Abstract-A's, and D, G, and B as subtypes of Abstract-A. But B is a
list of B-Childs. I tried defining B's "XmlText" member as being a
list of B-Childs, but you can only apply XmlText to strings (or arrays
of strings).

Any help would be appreciated.
*bump*

anybody? I keep running into schema of this style - the XMLSerializer
is so limited for stuff like this.

Feb 25 '07 #3

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

Similar topics

15
2328
by: Terje Slettebø | last post by:
Hi. I'm new here, and sorry if this has been discussed before; I didn't find it searching the PHP groups. (I've also read recommendations to cross-post to the other PHP groups, but if that is discouraged, please let me know. At the same time, please then let me know which of the many PHP groups to post to. :) ) In PHP5, you can provide "type hints" for functions, like this:
6
41196
by: ESOJAY | last post by:
Is "typedef long long int64" the best way to define an int64 type in c? Are there better alternatives? Thanks, ESOJAY -- ESOJAY
51
4568
by: jacob navia | last post by:
I would like to add at the beginning of the C tutorial I am writing a short blurb about what "types" are. I came up with the following text. Please can you comment? Did I miss something? Is there something wrong in there? -------------------------------------------------------------------- Types A type is a definition for a sequence of storage bits. It gives the meaning of the data stored in memory. If we say that the object a is an
7
4458
by: Kalyani | last post by:
Hi, I have a web service method which needs to return a hashtable.But it gives errror as, The type System.Collections.Hashtable is not supported because it implements IDictionary. Is there any way to return hashtable through a web method other than implementing the IDictionary? Please do tell me if any one knows.
6
9231
by: M.A. Oude Kotte | last post by:
Hi All, I hope this is the correct mailing list for this question. But neither postgresql.org nor google could help me out on this subject. I did find one disturbing topic on the mailing list archives (http://archives.postgresql.org/pgsql-admin/2000-05/msg00032.php), but since it was quite old I'm posting my question anyway. I'm writing a generic database layer that should support a fixed number of generic numeric types on a number of...
10
2134
by: nambissan.nisha | last post by:
I am facing this problem.... I have to define a structure at runtime as the user specifies... The user will tell the number of fields,the actual fields...(maybe basic or array types or multiple arrays,etc) I do not understand how to define the structure at run time.i.e.what fields it will contain.
11
3441
by: mesut demir | last post by:
Hi All, When I create fields (in files) I need assign a data type like char, varchar, money etc. I have some questions about the data types when you create fields in a file. What is the difference between data type 'CHAR' and 'TEXT'? When do you use 'VAR' in your datatype word? e.g. VARCHAR ?
8
3152
by: Smithers | last post by:
Are there any important differences between the following two ways to convert to a type?... where 'important differences' means something more profound than a simple syntax preference of the developer. x = someObject as MySpecificType; x = (MySpecificType) someObject; Thanks.
8
1860
by: lubomir dobsik | last post by:
hi, i have seen an interesting thing: #if sizeof((char*)0 - (char*)0) == sizeof(unsigned int) typedef unsigned int size_t; #elif sizeof((char*)0 - (char*)0) == sizeof(unsigned long) typedef unsigned long size_t; #elif sizeof((char*)0 - (char*)0) == sizeof(unsigned long long) typedef unsigned long long size_t; #endif
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10435
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10163
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9037
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.