[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2205
  • Last Modified:

vb.net Serializing Objects in ArrayList to XML

I have this wierd problem when i serialize an Arraylist of custom objects in vb.net 1.1:

The Arraylist is really a class that inherits an arraylist. But the annoying part is the "ArrayOfAnyType" and "anyType" element names. How do i change it to the CollectionName and object name

FROM
<ArrayOfAnyType>
- <anyType xsi:type="Animal">
  <RegionName>A & P - Midwest</RegionName>
  <EFormMultiplier>1.5000</EFormMultiplier>
    </anyType>
- <anyType xsi:type="Animal">
  <RegionName>ADP - Western</RegionName>
  <EFormMultiplier>1.5000</EFormMultiplier>
    </anyType>
</ArrayOfAnyType>


to

<AnimalCollection>
- <Animal>
  <RegionName>A & P - Midwest</RegionName>
  <EFormMultiplier>1.5000</EFormMultiplier>
    </Animal>
- <Animal>
  <RegionName>ADP - Western</RegionName>
  <EFormMultiplier>1.5000</EFormMultiplier>
    </Animal>
</AnimalCollection>
0
vinny45
Asked:
vinny45
2 Solutions
 
arif_eqbalCommented:
One look at it says you can use XSL Transforms and convert one schema to other
But if you are serializing and getting the first XML how are you getting the second one, or is it that you want the schema of the serialized object to be of the second type ?
0
 
jjardineCommented:
Try using attributes on your classes.   Here is an example of them.. http://www.topxml.com/xmlserializer/serialization_attributes.asp
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now