-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: ArunNAndU
Message 2 in Discussion






Hi
Rakesh<o:p></o:p>


<o:p> </o:p>


            It�s
no problem even if you mail to me directly also. But it would be fun if all got
involved or interacted or just came to know about it also. Moreover this could
even act as a KnowledgeBase right.<o:p></o:p>


            <o:p></o:p>


Well infact
it is going to. Thanks for trying this and reminding me that I had not detailed
on another cool class �XmlSerializerNamespaces�.<o:p></o:p>


<o:p> </o:p>


            Infact in our first session, we just touched upon this. This
class is for namespaces support during Serialization. I asked your xml header
to see which all namespaces were getting generated.<o:p></o:p>


<o:p> </o:p>


            Well
since only the default 2, xsd and xsi
namespaces are getting generated, I infer you did not define your own
namespace.<o:p></o:p>


<o:p> </o:p>


            The
above 2 namespaces are declared by default by XmlSerializer.
Well there is no documented way of getting this done. But an overriding is
possible.<o:p></o:p>


<o:p> </o:p>


            One
of the overloads for XmlSerializer::Serialize accepts
a  XmlSerializerNamespaces object. Which is similar to a
collection object, meaning a method Add, Count etc is available.<o:p></o:p>


<o:p> </o:p>


            Since
we saw, we could define our own set of namespaces and mix and match Xml, how do
we set them into the code<o:p></o:p>


<o:p> </o:p>


            Extending
our canonical employee The XmlSerialization code snippet
to have the namespaces, we would do so�<o:p></o:p>


<o:p> </o:p>


                  TextWriter writer = new StreamWriter( "emp.xml" );<o:p></o:p>


                  XmlSerializer serializer = new XmlSerializer( typeof(Employees)
);<o:p></o:p>


                  Employees
emps = new
Employees();<o:p></o:p>


                        emps.Employee = (EmployeeType[])mEmployees.ToArray( 
typeof(EmployeeType) );<o:p></o:p>


                  XmlSerializerNamespaces nameSpaces = new
XmlSerializerNamespaces();<o:p></o:p>


                        nameSpaces.Add(
�e�, �http://www.bdotnet.com/�); <o:p></o:p>


                  serializer.Serialize( writer, emps, nameSpaces );<o:p></o:p>


<o:p> </o:p>


            The
above would result in <e:Employees
xmlns:e=�http://www.bdotnet.com�>�</e:Employees> to appear<o:p></o:p>


<o:p> </o:p>


            To
not to have any namespaces, we add an empty namespace<o:p></o:p>


<o:p> </o:p>


                  TextWriter writer = new StreamWriter( "emp.xml" );<o:p></o:p>


                  XmlSerializer serializer = new XmlSerializer( typeof(Employees)
);<o:p></o:p>


                  Employees
emps = new
Employees();<o:p></o:p>


                        emps.Employee = (EmployeeType[])mEmployees.ToArray( 
typeof(EmployeeType) );<o:p></o:p>


                  XmlSerializerNamespaces nameSpaces = new
XmlSerializerNamespaces();<o:p></o:p>


                        nameSpaces.Add(
��, ��); <o:p></o:p>


                  serializer.Serialize( writer, emps, nameSpaces );<o:p></o:p>


            <o:p></o:p>


            this would give your desired output<o:p></o:p>


<o:p> </o:p>


                                    <Employees>�</Employees><o:p></o:p>


<o:p> </o:p>


Cheers!!!<o:p></o:p>


Arun<o:p></o:p>


<o:p> </o:p>


-----Original Message-----

From: icyIron7
[mailto:[EMAIL PROTECTED] 

Sent: <st1:date Month="9" Day="22"
Year="2003">Monday, September 22, 2003</st1:date> <st1:time
Hour="13" Minute="55">1:55 PM</st1:time>

To: Arun N. Kumar

Cc: [EMAIL PROTECTED]

Subject: Hi,


<o:p> </o:p>


<o:p></o:p>


 
  
  
<o:p></o:p>
  
  
  
New
  Message on BDOTNET<o:p></o:p>
  
 
 
  
  
<o:p></o:p>
  
 





<o:p> </o:p>


Hi,<o:p></o:p>


 
  
  
Reply

  <o:p></o:p>
  
  
  
   
    
    
 <o:p></o:p>
    
    
    
Reply to Sender   Recommend
    <o:p></o:p>
    
    
    
Message 1 in
    Discussion <o:p></o:p>
    
   
  
  
<o:p></o:p>
  
 
 
  
  
   
    
    
From: icyIron7 <o:p></o:p>
    
   
   
    
    


    

    Hi,

    

    

    This is the xsd header:

    

    <?xml version="1.0" encoding="utf-8" ?>

    <xs:schema elementFormDefault="qualified"

    xmlns:xs="http://www.w3.org/2001/XMLSchema";>

    <xs:element name="application" type="Application"
    />

    

    this is the xml header:

    

    

    - <application xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

    

    This one i'am sending it to the group also... actually i thought of putting
    

    the Q as a cc to the group but just forgot...

    

    Thanks and Regards,

    Rakesh.

    

    

    >From: "Arun N. Kumar" <[EMAIL PROTECTED]>

    >To: "Rakesh H K" <[EMAIL PROTECTED]>

    >Subject: RE: Hi,

    >Date: Mon, 22 Sep 2003 11:10:10 +0530

    >

    >Hi Rakesh

    >

    > Kindly post the q's on BDOTNET. SO that others could also make

    >use, I am fine with personal mails also.

    >

    > You say the xml output contains the xsd namespace ref also??

    >That is strange. That is required by XSD Document only and not the data

    >document. Well xsi comes by default.

    >

    > Your tags themselves can have namespaces, for which XSD has a

    >/namespace switch.

    >

    > Can you snippet out the header of the xsd and xml? I will let

    >you know.

    >

    >Regards,

    >_____________________________

    >Arun N Kumar

    >Software Architect

    >ZapApp India Private Limited

    >Level G & 1, Explorer Building,

    >International TechPark, Whitefield Road,

    >Bangalore - 560 066. INDIA

    >91-80- 5115 6050 extn. 4070 (phone)

    >91-80- 841 1858 (fax)

    >[EMAIL PROTECTED]

    >

    >

    >-----Original Message-----

    >From: Rakesh H K [mailto:[EMAIL PROTECTED]

    >Sent: Saturday, September 20, 2003 12:30 PM

    >To: Arun N. Kumar

    >Subject: RE: Hi,

    >

    >

    >Hi, Arun,

    >

    >This is Rakesh here, I have started some work on Xml Data Binding, and
    i

    >

    >have a problem here,

    >

    >I created an xsd and generated the .cs file and the generated xml file

    >contains these lines about the namespace i guess, how do i get rid of

    >these

    >??

    >

    >xmlns:xsd="http://www.w3.org/2001/XMLSchema";

    >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

    >

    >what i have tried till now is - commenting out the

    >System.Xml.Serialization.XmlTypeAttribute and in the

    >System.Xml.Serialization.XmlRootAttribute making the namespace value to

    >"".

    >

    >but still i get the above lines, how do i get rid of these.

    >

    >

    >Thanks and Regards,

    >Rakesh.

    >

    >

    >

    >

    > >From: "Arun N. Kumar" <[EMAIL PROTECTED]>

    > >To: "Rakesh H K" <[EMAIL PROTECTED]>

    > >Subject: RE: Hi,

    > >Date: Tue, 9 Sep 2003 10:09:24 +0530

    > >

    > >Hi Rakesh,

    > >

    > > We have a block on mail sites and file exchange, so wont be able

    > >to send it to you from here. The slides were done from the laptop
    so

    > >would have them posted somehow ASAP. As for the samples, will work
    on

    > >how to get it posted and get back to you soon.

    > >

    > > Sorry for the delay. If there is any question in particular, do

    > >shoot me an email or via bdotnet, I would be glad to help out.

    > >

    > >Regards,

    > >_____________________________

    > >Arun N Kumar

    > >Software Architect

    > >ZapApp India Private Limited

    > >Level G & 1, Explorer Building,

    > >International TechPark, Whitefield Road,

    > >Bangalore - 560 066. INDIA

    > >91-80- 5115 6050 extn. 4070 (phone)

    > >91-80- 841 1858 (fax)

    > >[EMAIL PROTECTED]

    > >

    > >

    > >-----Original Message-----

    > >From: Rakesh H K [mailto:[EMAIL PROTECTED]

    > >Sent: Tuesday, September 09, 2003 9:21 AM

    > >To: Arun N. Kumar

    > >Subject: Hi,

    > >

    > >

    > >Hi,

    > >

    > >I am Rakesh here, I am part of the BDOTNET and would like to go through

    > >your

    > >Plain Vanilla and the code attached. Could you please send it
    accross.

    > >

    > >Thanks and Regards,

    > >Rakesh.

    > >

    > >_________________________________________________________________

    > >Need a naukri? Your search ends here. http://www.msn.co.in/naukri/

    > >50,000 of

    > >the best jobs!

    > >

    > >

    >

    >_________________________________________________________________

    >Access Hotmail from your mobile now.

    >http://server1.msn.co.in/sp03/mobilesms/ Click here.

    >

    >

    

    _________________________________________________________________

    Get Married! http://www.bharatmatrimony.com/cgi-bin/bmclicks1.cgi?74 Search
    

    from 7 lakh Brides & Grooms.<o:p></o:p>
    
   
  
  
<o:p></o:p>
  
 





View other groups in this
category. 







-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]
  • Hi, icyIron7
    • ArunNAndU

Reply via email to