469,602 Members | 1,769 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

Is there a way to set a namespace prefix using XmlSerializer

I want to use the XmlSerializer to let .NET do the serialization for
me to produce the following XML:

<ws:Security xmlns:ws="http://schemas.xmlsoap.org/ws/2002/07/secext">

Is there any way, maybe through class and member attributes or
properties in the XmlSerializer, to be able to tell the XmlSerializer
to include the "ws:" prefix when it serializes the following classes?

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://schemas.xmlsoap.org/ws/2002/07/secext")]
[System.Xml.Serialization.XmlRootAttribute("Securit y",
public class Security {

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("User nameToken")]
public SecurityUsernameToken[] Items;

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://schemas.xmlsoap.org/ws/2002/07/secext")]
public class SecurityUsernameToken {

/// <remarks/>
public string Username;

/// <remarks/>
public string Password;
Nov 12 '05 #1
0 2721

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by siddharthkhare | last post: by
4 posts views Thread by Hollywood | last post: by
1 post views Thread by MattBell | last post: by
2 posts views Thread by scottpet | last post: by
2 posts views Thread by bmomalley | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.