Question Typed Datasets and Attributes

Tom

Well-known member
Joined
Aug 23, 2005
Messages
746
Programming Experience
5-10
I need to produce an Xml data file that follows specifications given to me by the USPS. I currently produce the file they want but I do it the long way and would like to upgrade this to use a Typed Dataset for the validation and also the easy output from there to an Xml file but they have a bit of a weird requirement.

They require a couple of attributes and the dataset designer doesn’t seem to be friendly towards allowing this. However I can edit it directly to force the required attributes. The problem is one of the fields is redundant. The want the PackageId field listed as an attribute in the Package table but they also have the same PackageId field within the table as an element. Sort of like trying to force the same field (and that being a primary key) into a database table twice. I have no clue why this field needs to be in there twice but I doubt there going to change there specs if I ask.

Any suggestions?
 
I wouldnt use datatables because they are always serialized in a certain way. Instead I'd make a custom class out of the XSD (do they give you an xsd? if not you might have to write one) and have 2 properties based off the same variable, one with an<XmlElement> and the other with an <XmlAttribute> decoration
 
Thanks I have something similar already but as said I would would like to find a way to implement this into a typed dataset and its just really bugging me that I havent been able to accomplish it (yet) because of this single attribute.
 
Back
Top