Interchange xsd and xsi in the output of XmlSerializer
Posted
by Sri Kumar
on Stack Overflow
See other posts from Stack Overflow
or by Sri Kumar
Published on 2010-04-05T10:36:42Z
Indexed on
2010/04/05
11:13 UTC
Read the original article
Hit count: 264
XmlSerializer serializer = new XmlSerializer(typeof(IxComment));
System.IO.StringWriter aStream = new System.IO.StringWriter();
serializer.Serialize(aStream,Comments);
commentsString = aStream.ToString();
Here the commentsString has the the following element in it
<IxComment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
Is there any possibility to interchange the xsi and xsd attribute and get the element as shown below
<IxComment xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
Will this cause any other issue?
EDIT: Why do i need to do this?
We are migrating an existing application from 1.1 to 3.0 and in the code there is a if loop
int iStartTagIndex = strXMLString.IndexOf("<IxComment xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">");
that check for the index of the IxComment. Here the o/p of the serializer and the condition differ in the position of xsd and xsi. So i am trying to know whether we can instruct the serializer to provided the o/p as required.
I have another question here as this was an existing application does the serializer O/P differs with versions?
© Stack Overflow or respective owner