![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: XML Namespace Prefix XML Namespace PrefixTo: NULL Date: 11/1/2006 11:51:00 AM
Can anyone tell me how to add an XMLNamespace prefix to a C# class
declaration? I have a couple of different namespaces that must be declared
in my XML file but I can't figure out what class/property attributes I need
to add to have a namespace prefix generated in front of the element when the
class is serialized.
I am looking for "rex" so the serialization will occur like the following.
<rex:ElementName>
<rex:Value1> A</rex:Value1>
<rex:Value2> B</rex:Value2>
</rex:ElementName>
So far all I am able to come up with is
<ElementName xmlns="rex">
<Value1 xmlns="rex"> A</Value1>
<Value2 xmlns="rex"> B</Value2>
</rex:ElementName >
I get this when I have the following
[XmlElementAttribute(ElementName="Foo", IsNullable=true,
Form=XmlSchemaForm.Qualified)]
public class Foo
{
[XmlElement("ElementName")]
public ElementName ElementName
{
get {return menElementName;}
set {menElementName = value;}
}
}
public class ElementName
{
[XmlElement("Value1")]
public string Value1
{
get;
set;
}
[XmlElement("Value2")]
public string Value2
{
get;
set;
}
}
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
