473,378 Members | 1,360 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,378 software developers and data experts.

Defining a type that works like the types that support XmlArrayAttribute

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 1265
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
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...
6
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
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...
7
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...
6
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...
10
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...
11
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...
8
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...
8
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.