PC Review


Reply
Thread Tools Rate Thread

Defining a type that works like the types that support XmlArrayAttribute

 
 
Martin Z
Guest
Posts: n/a
 
      23rd Feb 2007
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.

 
Reply With Quote
 
 
 
 
Martin Z
Guest
Posts: n/a
 
      23rd Feb 2007
On Feb 23, 12:24 pm, "Martin Z" <martin.zar...@gmail.com> wrote:
> 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.

 
Reply With Quote
 
Martin Z
Guest
Posts: n/a
 
      25th Feb 2007
On Feb 23, 12:24 pm, "Martin Z" <martin.zar...@gmail.com> wrote:
> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Outlook Automation - Defining Data Types Douglas J. Steele Microsoft Access VBA Modules 0 5th May 2008 07:00 PM
Defining a type of the cell backspace Microsoft Excel Programming 1 7th Sep 2006 11:09 AM
Defining data types for fields, when you a create a file mesut demir Microsoft VB .NET 11 10th Mar 2006 08:30 AM
Defining a Data Type JamesJ Microsoft Access Form Coding 9 3rd Oct 2004 05:01 PM
defining a simple type Donnie Fuqua Microsoft C# .NET 1 19th Jul 2004 08:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:05 PM.