473,386 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

suppressing xsd namespace declarations with XmlSerialize?

Hi...

I'm just starting to play around with xml serialization. Is there any way
to suppress the xsd and xsi declarations in the resulting xml? It doesn't
appear that they're used but they come out anyway.

Thanks
-Mark

Jan 25 '07 #1
3 3055
Hi Mark,

We need to perform more research on this issue . We will reply here as soon
as possible.
If you have any more concerns on it, please feel free to post here.

Thanks for your understanding!
Best regards,
Wen Yuan

Jan 26 '07 #2
Hi Mark,
Thanks for your wait.

If you don¡¯t need xsi and xsd declaration with xml serialization, you can
use XmlSerializerNamespaces object.

XmlSerializerNamespaces xmlnsEmpty = new XmlSerializerNamespaces();
xlnsEmpty.Add("", "");
// Serialization
XmlSerializer s = new XmlSerializer(typeof(XmlSerializerClass));
TextWriter w = new StreamWriter(@"c:\list.xml");
s.Serialize(w, myList,xmlnsEmpty);
w.Close();

Please feel free to reply me if there is anything unclear, and we will
follow up.

Have a great weekend!
Best regards,
Wen Yuan
Jan 26 '07 #3
Thanks Wen Yuan... That was exactly what I needed.

Mark
"WenYuan Wang" wrote:
Hi Mark,
Thanks for your wait.

If you don¡¯t need xsi and xsd declaration with xml serialization, you can
use XmlSerializerNamespaces object.

XmlSerializerNamespaces xmlnsEmpty = new XmlSerializerNamespaces();
xlnsEmpty.Add("", "");
// Serialization
XmlSerializer s = new XmlSerializer(typeof(XmlSerializerClass));
TextWriter w = new StreamWriter(@"c:\list.xml");
s.Serialize(w, myList,xmlnsEmpty);
w.Close();

Please feel free to reply me if there is anything unclear, and we will
follow up.

Have a great weekend!
Best regards,
Wen Yuan
Jan 26 '07 #4

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

Similar topics

2
by: Anonymous | last post by:
How do I reference a namespace variable in a multi-file project? Do I use the keyword 'extern'? If so, does the word 'extern' modify the namespace or the individual variables within the...
1
by: indo3 | last post by:
HELLO For the top root element of my schema file, i want to declare following attribute: <xs:attribute name="xmlns:m" type="xs:string" default="http://www.w3.org/1998/Math/MathML"/> But...
3
by: Mike Dickens | last post by:
hi, i'm sure this has come up before but havn't managed to find an answer. if i have the following xslt <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet method="xml" version="1.0"...
1
by: JustSomeGuy | last post by:
I am writing classes and I want them to belong to mynamespace What is the syntax to say that the class I'm defining is a member of mynamespace? What is the scope of the syntax and how does one...
2
by: Peter Bates | last post by:
Hi, I'm just getting used to XSDObjectGen and i have the following question. Can i use a class inherited from a class generated by XSDObjectGen with XmlSerialize? Specifically, I have many...
14
by: Jon Rea | last post by:
I am currently cleaning up an application which was origainlly hashed together with speed of coding in mind and therefore contains quite a few "hacky" shortcuts. As part of this "revamping"...
32
by: toolmaster | last post by:
Since many of the modern computer languages have built-in namespace features, I can't understand why not add this feature into standard C. I've heard many people complain of the lacking of...
8
by: Simon Brooke | last post by:
I was debugging a new XML generator tonight and trying to determine why it wasn't working; and realised my dom printer does not output XML namespace declarations. My method to output an Element...
10
by: Andy Fish | last post by:
hi, I have an XSLT which is producing XML output. many of the nodes in the output tree contain namespace declarations for namespaces that are used in the source document even though they are...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...

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.