Serialization Issue

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
 
M

miher

"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
 
G

Garry_UK

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top