EDN Admin
Well-known member
I was sent here from the C# forum.
<div style="color:#000000; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:10px; background-color:#ffffff; margin:8px
I have three classes that were created from XSD files using the xsd command line tool, called MSApprovalDS, MSSettleDS and MSCreditDS.
<span>They need to serialize to MSApproval<span>, MSSettle and MSCredit.
<span>I cant name the class MSApproval because it has a method in it (not the constructor) named MSApproval, so I put in the line
<div style="color:black; background-color:white
<pre style="color:#000000; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:10px; margin:8px; border:1px solid #d0d0d0 [global::System.Xml.Serialization.XmlRootAttribute(<span style="color:#a31515 MSApproval)] (or MSSettle, MSCredit)
[/code]
above each class definition.
(I am converting from a VB.NET project where a method can have the same name as the class, since the keyword New is the constructor.)
Two of them, MSApproval and MSSettle work fine.
<div style="color:black; background-color:white
<pre style="color:#000000; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:10px; margin:8px; border:1px solid #d0d0d0 <span style="color:blue <<span style="color:#a31515 MSApproval<span style="color:blue >
...
<span style="color:blue </<span style="color:#a31515 MSApproval<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 MSSettle<span style="color:blue >
...
<span style="color:blue </<span style="color:#a31515 MSSettle<span style="color:blue >
[/code]
The third generates XML that looks like
<div style="color:black; background-color:white
<pre style="color:#000000; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:10px; margin:8px; border:1px solid #d0d0d0 <span style="color:blue <<span style="color:#a31515 MSCredit <span style="color:red xmlns<span style="color:blue =<span style="color:black "<span style="color:blue MSCredit<span style="color:black "<span style="color:blue >
...
<span style="color:blue </<span style="color:#a31515 MSCredit<span style="color:blue >
[/code]
<span style="white-spacere <span style="white-space:normal which the remote server (which I have no control over) rejects because it says it does not recognize the namespace.
How can I stop it from adding the namespace?
View the full article
<div style="color:#000000; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:10px; background-color:#ffffff; margin:8px
I have three classes that were created from XSD files using the xsd command line tool, called MSApprovalDS, MSSettleDS and MSCreditDS.
<span>They need to serialize to MSApproval<span>, MSSettle and MSCredit.
<span>I cant name the class MSApproval because it has a method in it (not the constructor) named MSApproval, so I put in the line
<div style="color:black; background-color:white
<pre style="color:#000000; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:10px; margin:8px; border:1px solid #d0d0d0 [global::System.Xml.Serialization.XmlRootAttribute(<span style="color:#a31515 MSApproval)] (or MSSettle, MSCredit)
[/code]
above each class definition.
(I am converting from a VB.NET project where a method can have the same name as the class, since the keyword New is the constructor.)
Two of them, MSApproval and MSSettle work fine.
<div style="color:black; background-color:white
<pre style="color:#000000; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:10px; margin:8px; border:1px solid #d0d0d0 <span style="color:blue <<span style="color:#a31515 MSApproval<span style="color:blue >
...
<span style="color:blue </<span style="color:#a31515 MSApproval<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 MSSettle<span style="color:blue >
...
<span style="color:blue </<span style="color:#a31515 MSSettle<span style="color:blue >
[/code]
The third generates XML that looks like
<div style="color:black; background-color:white
<pre style="color:#000000; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:10px; margin:8px; border:1px solid #d0d0d0 <span style="color:blue <<span style="color:#a31515 MSCredit <span style="color:red xmlns<span style="color:blue =<span style="color:black "<span style="color:blue MSCredit<span style="color:black "<span style="color:blue >
...
<span style="color:blue </<span style="color:#a31515 MSCredit<span style="color:blue >
[/code]
<span style="white-spacere <span style="white-space:normal which the remote server (which I have no control over) rejects because it says it does not recognize the namespace.
How can I stop it from adding the namespace?
View the full article