473,386 Members | 1,708 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.

XML Namespace & Serialization

We have an object structure which maps to an XML Schema we have defined. This
schema has complex types which are causing XML Namespace information to be
embedded into the XML when we use the XMLSerializer to serialize the objects.
Do you know if there is a way to prevent the namespace information from being
embedded in the XML by the serializer?

-Tammy
Aug 10 '06 #1
3 1765
Can you give an example? Your code?

chanmm

"Tammy Lemire" <Tammy Le****@discussions.microsoft.comwrote in message
news:BA**********************************@microsof t.com...
We have an object structure which maps to an XML Schema we have defined.
This
schema has complex types which are causing XML Namespace information to be
embedded into the XML when we use the XMLSerializer to serialize the
objects.
Do you know if there is a way to prevent the namespace information from
being
embedded in the XML by the serializer?

-Tammy

Aug 10 '06 #2
Why do you want to do this?

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Accept the Unexpected.

"Tammy Lemire" <Tammy Le****@discussions.microsoft.comwrote in message
news:BA**********************************@microsof t.com...
We have an object structure which maps to an XML Schema we have defined.
This
schema has complex types which are causing XML Namespace information to be
embedded into the XML when we use the XMLSerializer to serialize the
objects.
Do you know if there is a way to prevent the namespace information from
being
embedded in the XML by the serializer?

-Tammy

Aug 10 '06 #3
This is how we are serializing the object:

writer = new XmlTextWriter(new MemoryStream(), enc);
XmlSerializer serializer = new XmlSerializer(o.GetType());
serializer.Serialize(writer, o);
byte[] bytes = ((MemoryStream)writer.BaseStream).ToArray();
writer.Flush();
return enc.GetString(bytes, 0, bytes.Length).Trim();

The object itself has multiple namespaces in it since it declares an
instance of another object b for example which is in a different namespace

"chanmm" wrote:
Can you give an example? Your code?

chanmm

"Tammy Lemire" <Tammy Le****@discussions.microsoft.comwrote in message
news:BA**********************************@microsof t.com...
We have an object structure which maps to an XML Schema we have defined.
This
schema has complex types which are causing XML Namespace information to be
embedded into the XML when we use the XMLSerializer to serialize the
objects.
Do you know if there is a way to prevent the namespace information from
being
embedded in the XML by the serializer?

-Tammy


Aug 10 '06 #4

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

Similar topics

0
by: T | last post by:
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"> <ws:UsernameToken>...
6
by: David B. Bitton | last post by:
I am having a problem deserializing XML when the root node is missing a namespace declaration. My Type has an XmlTypeAttribute with a namespace defined. If I attempt to deserialize the XML, I get...
0
by: Peter Theill | last post by:
Hi, I'm having an issue with deserializing some xml using a proxy class generated by "xsd.exe". My proxy class contains this class definition: public class IqProfileType {
1
by: MattBell | last post by:
I have a root node attribute which contains a name space declaration. I'd like to put a reference onto the front of it (ie: ns1:RootNode) where ns1 is defined as the namespace I'm using. Is...
0
by: Alberto Grosso Nicolin | last post by:
We have the following XML schema: there's a root element (Response) with of a single child element (Result). ...
0
by: richwangler | last post by:
This problem should be easily reproducable if anybody has the time. I need to build the following XML programatically and decided to use the XMLSerializer. I simplified the XML (myExample.xml)...
2
by: Pathogenix | last post by:
Greetings, I'm trying to fix a web service client which has been implemented in a dailywtf worthy manner. I've decided to rip all the old code out and start again from the proxy generated by...
2
by: Bob | last post by:
Just new at this, Vs 2005 Vb.net Created a new Windows control library User control project. Only 1 file UserControl1.vb No code or object in it at all yet except what was placed by default when...
9
by: Mark Olbert | last post by:
I'm trying to serialize (using XmlSerializer.Serialize) a class that I generated from an XSD schema using XSD.EXE /c. The problem I'm running into is that the root element needs to be unqualified,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.