xmlSerializer---root object --namespace prefix

S

siddharthkhare

HiAll,
i am having hard time serializing a object in a specific xml.I need to
feed it to a biztalk port.


i Have a root object(c# class) 'CTSCServiceOrder'.

When i serilize it using a xml serializer following is the out put.

<?xml version="1.0"?>
<CTSCServiceOrder
xmlns="ns0:http://CTSC.SI.Delinquency.BizTalk.InRequest"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" IsOperation="0" >
.......Rest of the child here
</CTSCServiceOrder>

I want to get a output as shown below...Want to have prefix in front of
the 'CTSCServiceOrder' element


<?xml version="1.0"?>
<ns0:CTSCServiceOrder
xmlns="ns0:http://CTSC.SI.Delinquency.BizTalk.InRequest"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" IsOperation="0" >
.......Rest of the child here
</ns0:CTSCServiceOrder>


and i have tried following solution

1)srRequest = new
XmlSerializer(typeof(CTSCServiceOrder),"ns0:http://CTSC.SI.Delinquency.BizTalk.InRequest");

2)[XmlRoot("CTSCServiceOrder",
Namespace="ns0:http://CTSC.SI.Delinquency.BizTalk.InRequest" )]

public class CTSCServiceOrder {......}

3)[System.Xml.Serialization.XmlTypeAttribute(Namespace="ns0:http://CTSC.SI.Delinquency.BizTalk.InRequest")]



I could get the namespace defined using the solution i mentioned above
but it does not prefix the root element with the prefix.


CTSCServiceOrder class is the root class.


Is there a way to do this?
Thanks
siddharth
 

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