473,795 Members | 2,854 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xmlSerializer---root object --namespace prefix

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) 'CTSCServiceOrd er'.

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

<?xml version="1.0"?>
<CTSCServiceOrd er
xmlns="ns0:http ://CTSC.SI.Delinqu ency.BizTalk.In Request"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" IsOperation="0" >
.......Rest of the child here
</CTSCServiceOrde r>

I want to get a output as shown below...Want to have prefix in front of
the 'CTSCServiceOrd er' element
<?xml version="1.0"?>
<ns0:CTSCServic eOrder
xmlns="ns0:http ://CTSC.SI.Delinqu ency.BizTalk.In Request"
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:CTSCService Order>
and i have tried following solution

1)srRequest = new
XmlSerializer(t ypeof(CTSCServi ceOrder),"ns0:h ttp://CTSC.SI.Delinqu ency.BizTalk.In Request");

2)[XmlRoot("CTSCSe rviceOrder",
Namespace="ns0: http://CTSC.SI.Delinqu ency.BizTalk.In Request" )]

public class CTSCServiceOrde r {......}

3)[System.Xml.Seri alization.XmlTy peAttribute(Nam espace="ns0:htt p://CTSC.SI.Delinqu ency.BizTalk.In Request")]

I could get the namespace defined using the solution i mentioned above
but it does not prefix the root element with the prefix.
CTSCServiceOrde r class is the root class.
Is there a way to do this?
Thanks
siddharth

Jul 21 '05 #1
0 1530

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7310
by: Romeo Disca | last post by:
Hello newsgroup, i'm new to xml - what's wrong with this piece code here? i have these two files: test.xml ---- <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE a SYSTEM "test.ent"
4
2630
by: Hollywood | last post by:
I'm using XML serialization to produce the following XML document: <TestDoc xmlns:srd="some-url"> <Additional> <Security> <srd:Login>login_id</srd:Login> <srd:Password>password</srd:Password> </Security> </Additional> </TestDoc>
2
2704
by: Frank Wilson | last post by:
Is there a way to change the namespace prefix of a document? I am sending a document to an application that requires that every element be prefixed with "sm". My inbound document has every element prefixed with "ns0". Is there way to do this without looping through every node? Thanks, Frank
2
2012
by: Dale Anderson | last post by:
I have a schema that I'm trying to read. The schema has an element named 'GrantApplication' and one with a namespace prefix named 'SF424:GrantApplication'. When I try to read this schema in, I get an exception saying 'A datatable named 'GrantApplication' alread belongs to this dataset'. Why is dotnet not recognizing the namespace prefix and treating these like two separate elements? Thanks for your help.
0
370
by: siddharthkhare | last post by:
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"?>
4
4605
by: jb | last post by:
I have discovered that when the WSDL is auto-generated in .NET (i.e. http://.../MyService.asmx?WSDL): * Prior to SP1, it generated xmlns:s0="http://mynamespace/" in <wsdl:definitions>, and then output my web methods as "s0:MyWebMethod" in <wsdl:message> sections * At SP1, it generates xmlns:tns="http://mynamespace/" in <wsdl:definitions>, and then output my web methods as "tns:MyWebMethod" in <wsdl:message> sections
1
5903
by: Tanja Schaettler | last post by:
Hello! I have an existing SOAP message which looks like: <?xml version="1.0" encoding="UTF-8" ?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body>
2
21646
by: scottpet | last post by:
Hi, I want to add a namespace prefix to the root node of an object I am serializing to XML. I have been reading though this article: http://msdn2.microsoft.com/en-gb/library/system.xml.serialization.xmlnamespacedeclarationsattribute.aspx I get namespace prefixes in the document, but not on the root node. Specifically, the serializer does not work as described in the last
3
8450
by: Markus Bauer | last post by:
Hello, I have a problem with the namespace prefix. I need to add nodes to a xml file that is not created by me. It has a namespace with the prefix "NFD". So an already existing node looks like that: <NFD:Sonstiger_Hinweis> <NFD:Erfassungsdatum>20070102</NFD:Erfassungsdatum>
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10448
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9046
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7544
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6784
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.