Serialization Issue

  • Thread starter Thread starter Garry_UK
  • Start date Start date
G

Garry_UK

Please help.

I have a class that is along the lines of

Public class Products
ProductID as integer
ProductName as string
Manufacturer() as manufacturer

Public class Manufacturer
ManufacturerName as String


When I serialize the object for a SOAP post(Document Type) my SOAP post
looks like

<Product>
<ProductID>1</ProductID>
<ProductName>Bucket</ProductName>
<Manufacturer>
<Manufacturer>
<ManufacturerName>Smiths Buckets<ManufacturerName>
</Manufacturer>
<Manufacturer>
<ManufacturerName>Kerrs Buckets and Spades<ManufacturerName>
</Manufacturer>
</Manufacturer>
</Product>

What I really want to see is
<Product>
<ProductID>1</ProductID>
<ProductName>Bucket</ProductName>
<Manufacturer>
<ManufacturerName>Smiths Buckets<ManufacturerName>
</Manufacturer>
<Manufacturer>
<ManufacturerName>Kerrs Buckets and Spades<ManufacturerName>
</Manufacturer>
</Product>

What do I need to do in my class declaration to elimate this extra node when
serializing?

Many Thanks
 
"Garry_UK" <[email protected]> az alábbiakat írta a
következő üzenetben
Please help.

I have a class that is along the lines of

Public class Products
ProductID as integer
ProductName as string
Manufacturer() as manufacturer

Public class Manufacturer
ManufacturerName as String


When I serialize the object for a SOAP post(Document Type) my SOAP post
looks like

<Product>
<ProductID>1</ProductID>
<ProductName>Bucket</ProductName>
<Manufacturer>
<Manufacturer>
<ManufacturerName>Smiths Buckets<ManufacturerName>
</Manufacturer>
<Manufacturer>
<ManufacturerName>Kerrs Buckets and Spades<ManufacturerName>
</Manufacturer>
</Manufacturer>
</Product>

What I really want to see is
<Product>
<ProductID>1</ProductID>
<ProductName>Bucket</ProductName>
<Manufacturer>
<ManufacturerName>Smiths Buckets<ManufacturerName>
</Manufacturer>
<Manufacturer>
<ManufacturerName>Kerrs Buckets and Spades<ManufacturerName>
</Manufacturer>
</Product>

What do I need to do in my class declaration to elimate this extra node
when
serializing?

Many Thanks

Hi,

Put XmlElementAttribute on the Manufacturer array in the Products class with
empty("") ElementName.

Hope You find this useful.
-Zsolt
 
This Worked perfectly.


Thanks

miher said:
"Garry_UK" <[email protected]> az alábbiakat írta a
következő üzenetben


Hi,

Put XmlElementAttribute on the Manufacturer array in the Products class with
empty("") ElementName.

Hope You find this useful.
-Zsolt
 
Back
Top