XmlSerializer help

Hi,
I have a class:
public class Note
{
    public string name;
    public string information;
}

And i Serialize this class, but want to Serialize it to an XmlDocument which 
will contain many of these elements.

How do i do this?

Thank you,

Tim. 


0
tripix (16)
6/5/2004 4:15:12 AM
dotnet.xml 7266 articles. 0 followers. Follow

3 Replies
1061 Views

Similar Articles

[PageSpeed] 45

Timothy,

take a look at Chris Lovett's XmlNodeWriter on www.gotdotnet.com [0].

Simply pass the node where you want to insert the serialized XML into the 
XmlDocument to an XmlNodeWriter and pass the XmlNodeWriter to the Serialize 
method.

-- 
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

[0] 
http://gotdotnet.com/Community/User/Samples/download.aspx?FileGuid=de71bc7f-4ae0-41f4-b0dd-2e378a25b797

"Timothy V" <tripix@msn.com> wrote in message 
news:%232L3vOrSEHA.1168@TK2MSFTNGP11.phx.gbl...
> Hi,
> I have a class:
> public class Note
> {
>    public string name;
>    public string information;
> }
>
> And i Serialize this class, but want to Serialize it to an XmlDocument 
> which will contain many of these elements.
>
> How do i do this?
>
> Thank you,
>
> Tim.
> 


0
6/5/2004 4:25:50 PM
Thanks! That works. However, is there any other way to do it? (ie not use 
XmlNodeWriter)

Thanks,

Tim.

"Christoph Schittko [MVP]" <christophdotnetINVALID@austin.rr.com> wrote in 
message news:e9NLEnxSEHA.1172@TK2MSFTNGP11.phx.gbl...
> Timothy,
>
> take a look at Chris Lovett's XmlNodeWriter on www.gotdotnet.com [0].
>
> Simply pass the node where you want to insert the serialized XML into the 
> XmlDocument to an XmlNodeWriter and pass the XmlNodeWriter to the 
> Serialize method.
>
> -- 
> HTH
> Christoph Schittko [MVP]
> Software Architect, .NET Mentor
>
> [0] 
> http://gotdotnet.com/Community/User/Samples/download.aspx?FileGuid=de71bc7f-4ae0-41f4-b0dd-2e378a25b797
>
> "Timothy V" <tripix@msn.com> wrote in message 
> news:%232L3vOrSEHA.1168@TK2MSFTNGP11.phx.gbl...
>> Hi,
>> I have a class:
>> public class Note
>> {
>>    public string name;
>>    public string information;
>> }
>>
>> And i Serialize this class, but want to Serialize it to an XmlDocument 
>> which will contain many of these elements.
>>
>> How do i do this?
>>
>> Thank you,
>>
>> Tim.
>>
>
> 


0
tripix (16)
6/6/2004 1:06:27 AM
Nothing that's equally elegant ... and if you want the result to be in an 
XmlDocument then it's the way to go.

If you just need a string or a stream, then you can serialize to a 
StreamWriter or an XmlTextWriter.

-- 
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

"Timothy V" <tripix@msn.com> wrote in message 
news:uM0jAK2SEHA.2408@tk2msftngp13.phx.gbl...
> Thanks! That works. However, is there any other way to do it? (ie not use 
> XmlNodeWriter)
>
> Thanks,
>
> Tim.
>
> "Christoph Schittko [MVP]" <christophdotnetINVALID@austin.rr.com> wrote in 
> message news:e9NLEnxSEHA.1172@TK2MSFTNGP11.phx.gbl...
>> Timothy,
>>
>> take a look at Chris Lovett's XmlNodeWriter on www.gotdotnet.com [0].
>>
>> Simply pass the node where you want to insert the serialized XML into the 
>> XmlDocument to an XmlNodeWriter and pass the XmlNodeWriter to the 
>> Serialize method.
>>
>> -- 
>> HTH
>> Christoph Schittko [MVP]
>> Software Architect, .NET Mentor
>>
>> [0] 
>> http://gotdotnet.com/Community/User/Samples/download.aspx?FileGuid=de71bc7f-4ae0-41f4-b0dd-2e378a25b797
>>
>> "Timothy V" <tripix@msn.com> wrote in message 
>> news:%232L3vOrSEHA.1168@TK2MSFTNGP11.phx.gbl...
>>> Hi,
>>> I have a class:
>>> public class Note
>>> {
>>>    public string name;
>>>    public string information;
>>> }
>>>
>>> And i Serialize this class, but want to Serialize it to an XmlDocument 
>>> which will contain many of these elements.
>>>
>>> How do i do this?
>>>
>>> Thank you,
>>>
>>> Tim.
>>>
>>
>>
>
> 


0
6/8/2004 2:51:12 AM
Reply:

Similar Artilces:

I Need Help with Average Formula I Need Assistance!!!
This is what i am trying to use but get Value or False errors & also tried as an array =IF(AR6="L",OR(AW6>""),AVERAGE(IF(AU$6:AU$66>=0,AU$6:AU$66),AU6,"")) This is what i need if AR6=L or AW6>"" then have to Average AU6:AU66 IF AR6="" OR AW6="" I need to use value in AU6 then if cells are blank use "" Mike, I'm not 100% sure of what you are asking for, but I will point out corrections that I see: 1) your OR argument is out of order. Try something like this: =IF(OR(AR6="L",AW6...

I need help...
....when I receive emails with a link on them, I can no longer open the link. This was never a problem before, only in the last 3 days. Can anyone help me? Thanks!!!!!!!!! On 23 Nov 2005 16:17:01 -0800, "sonnek@hickorytech.net" <sonnek@hickorytech.net> wrote: >...when I receive emails with a link on them, I can no longer open the >link. This was never a problem before, only in the last 3 days. Can >anyone help me? Thanks!!!!!!!!! If you're using Outlook 2003 (you didn't specify), and these messages are in your Junk E-mail folder, that is normal. If you want...

help with money
Windows 98, Microsoft money 2002, when trying to access with .net passport it tells me that it cannot access online will try using offline that always works, it has worked for offline for two weeks, but still cannot use background banking. I have checked everyhting that can be checked what else can I do. when I check to see the status it tells me that I am online that it is enabled, so why is it goint offline to sign me in? How can I fix this. Thank You. ( it's not the website or the .net passport site that's down I have done checked those several times according to directio...

XmlSerializer Collection with Collections
Hello I got this working but it is not how I really want it, basically I have an xml file which has a root of <test> and can be filled with 3 different types of <question> elements with different attributes, all share a base set of 4, one of the question types can have children with <option> elements, this is how the xml looks after serialization.... If you notice there is an extra <SelectionList> around the <option>'s in the final <question>, how can I write my class so I don't have this extra <SelectionList> element....my class follows, you ...

Vlookup help #2
I have two worksheets. Sheet 1 contains a number in column A and a name in column C. On Sheet 2 I put my data from a csv file. What I would like to do is vlookup Sheet 1 column C from the information on Sheet 2 and return the number in column A that is associated with the name in column C. Ex. Sheet 1 Sheet 2 A B C A B 33 N6-270-15 N6-270-75 35 34 N6-270-30 N...

SFO help
I have a quick question. My client's SFO button's wont install, and generally, their SFO installation is unstable. Given that we're hosting Exchange and CRM for the client and they're accessing our systems via VPN, does SFO work when their systems are not part of the domain that we've set up for them locally on our premises? Thanks!! Chris ...

sql summarizing help
Hi All, Given: table1 --------- id, cdate, weeksago, amount, typeid, timeclose 496, 2010-02-11, 0, 450, 3, 1 490, 2010-02-01, 1, 200, 4, 1 491, 2010-02-01, 1, 350, 2, 2 493, 2010-02-01, 1, 500, 5, 1 489, 2010-01-21, 3, 150, 2, 1 136, 2010-01-12, 4, 500, 3, 2 137, 2010-01-12, 4, 100, 3, 1 138, 2010-01-12, 4, 500, 2, 1 1. i'm trying to create a sql that will give me a summary resultset grouped by weeksago. 2. i want to sum the columns and get counts based on typeid. 3. avg of timeclose here's the sql i have: select weeksago, , (sum(timeClose)/(count(timeclo...

Status unreachable PLEASE HELP
Hello all, When I go to tools => Monitoring and status => status in the exchange system manager, in the right pane, one of my servers in another routing group is reported unreachable. However, mail connectivity is working between the 2 routing groups. Any idea's? Thanks Glenn ...

VBA/Macro/Date format help
Hello Firstly I apologise if this is not the right forum. Some kind soul (I forget who, sorry) wrote me a macro that copied the contents of 4 columns to another part of a spreadsheet if the date matched today's date. For some reason I can't fathom, when it copies the date, it does so in US format rather than the UK format which is the setting for my PC. Given that today's date (2nd August) in UK reads as 02/08/03 the US format returns the date of Feb 2nd. I really don't understand VBA at all, when I call the help file Excel can't locate it, and I'm struggling! I can ...

Help with time please.
I have this formula that caluclates time"=IF(K27-E25+F25-L27<=0,0,K27-E25+F25-L27)". in cell G25. It works fine if E25 is 11:00 PM and F25 is 11:30 PM. If I try to calculate E25 is 11:55 PM and F25 is 12:05 AM it gives me 0:00. What is wrong? Floyd This also depends on your values of K27 and L27 (I suspect these are dates), but think of 12:05AM as being 0:05 - it is less than 23:55 (11:55PM), and as you are subtracting one from the other the result is less than 0, so your formula returns 0. Hope this helps. Pete Floyd Forbes wrote: > I have this formula that caluclate...

Please Help with Windows Defender Error
Hi, I hope someone can help me. I have read so many documents and tried so many things that do not work. When I turn on my computer I get this error message about windows defender. Error Code 0x800106ba Application failed to initialize.... I found this article "Article ID: 931849 - Last Review: May 4, 2010 - Revision: 3.0" . I tried everything and nothing worked. I got to the last option, #4 and this file wuaueng.dll was not succefull in running. Here is what the last option # 4 says to do. If this issue is not resolved after you complete step 3, follow this step:...

XmlSerializer
I'm having a basic problem with the XmlSerializer & i'm at my wits end trying to sort it out i have a basic clas <Serializable()> Class Tes Public Name as Strin End Clas when this serializes i wan <Test><Name>Value</Name></Test the problem is if i use the XmlSerializer clas Dim t as Tes t.Name="Value Dim sb As New StringBuilde Dim sw As New StringWriter(sb Dim Serializer As New XmlSerializer(Message.GetType Serializer.Serialize(sw, t Serializer = Nothin Console.Write(sb.ToStr...

Manual remove Exchange 2000 from AD
Hi, I inherited a Windows 2000 Active Directory network that I have been cleaning up. Im installed Exchange 2003 only to find out there was a failed Exchange 2000 install from years ago that AD still sees. When I open the Exchange System Manager tool it shows my new Exchange 2003 server and this old Exchange 2000 server. And it somehow blended the configs so my Recipient Update Service were pointing to a server that didnt exist. My question is how can I remove the Exchange 2000 server from AD when the physical server is not around anymore to un-install? Thanks for the help. -Ken Hi Ken...

XmlSerializer and shared objects (or How to generate IDREFs using XmlSerializer)
This is a multi-part message in MIME format. ------=_NextPart_000_007F_01C34AC1.11D4FB20 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I am trying to find a solution that will allow me to use XmlSerializer = to serialize/deserialize a collection of objects where a given object is = shared between two or more other objects, and not create duplicate XML = representations of the shared object, but instead use IDREFs to refer to = the shared object. The XML I'm trying to produce is as follows (where "href" is an IDREF): <...

Excel if statement help
I have a valid, working excel formula that states: =IF(BL17>=1,1,0) However, I need it to say If bl17 (or bl19) are greater or equal to 1, than 1, else 0 The or bl19 is really the only new part. How can I add that in with correct syntax ? Just look in the help index for OR -- Don Guillett Microsoft MVP Excel SalesAid Software dguillett1@austin.rr.com <cegarbage@gmail.com> wrote in message news:df47d203-0fc7-4b73-ae96-662b900f835b@x41g2000hsb.googlegroups.com... >I have a valid, working excel formula that states: > > =IF(BL17>=1,1,0) > > However, I need it to ...

help urgent
i cant download attachment. system complain OE remove access to file. what is OE pls Tools-> Options-> tab Security-> option Do not allow attachments... Note that this is an Microsoft Office Outlook forum. Outlook Express is family of Internet Explorer and Outlook of the Office family. Here is the link for the right forum http://communities.microsoft.com/newsgroups/default.asp?icp=InternetExplorer Good Luck! -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -Creating Signatures -Create an Office XP CD slipstreamed with Service Pack 3 ----- "ade&...

Module Help
I want to take this module and edit it so the info is added to a table when a user opens the database, and removes the user from the table when they close the database. Any suggestions? I have a public database that I have to maintain that it's used 24 hours a day, and need to be able to find the users who are using it. The ldb file only gives me their workstation IDs, not their user IDs. Thanks. --------------------------------------------------- Function fGetUserName() As String ' Returns the network login name Dim lngLen As Long, lngRet As Long Dim strUserName As String strUser...

"Help Files" do not open beyond Table of Contents
I have Office Enterprise 2007 and none of the programs' Help Files will open. The Table of Contents comes up, but none of the individual questions I click on respond. I have tried both "on-line" and from my local computer. I uninstalled and re-installed everything, and they still do not work. Thank you. ...

XmlSerializer and inherited objects
Hi I have a hirachy of classes which are Message(base), then FileMessage and ChatMessage (extended) I want to serialize the objects and when i am deserizaling i dont know if i am getting FileMessage or ChatMessage. So how to get that object and use it I have written following code for serialization public void Send(Message message) { NetworkStream netWorkStream=null; try { XmlSerializer serializer=new XmlSerializer(message.GetType()); netWorkStream=new NetworkStream(_clientSocket); Stream stream=(Stream)netWorkStream; serializer.Serialize(stream,message); } finally { netWorkStrea...

HELP!!! EXCEL!!!
I need help from someone who knows alot of windows and excel. I had something very important saved to Excel, and I went to open it, and there was an error, saying do chkdsk.exe, so i did that. Now when I open the file in excel, it opens but its in turkish or weird writing, if i change it to English, its still not my work its a bunch of letters and boxes. How do I get my work back??? Please email me at nceantonio@yahoo.com... thank you Christina ...

Outlook search
Hello everyone! I am using Outlook (Office XP) and I would like to know if there is a way to set that when I search through mailbox Outlook starts to search with the newest messages - not with the oldest. It is quite a problem for me, because I have a lot of messages in my folder and I ususally need to search for the earliest version of specific message. Is it possible to set how to search through the mailbox. TNX for any help! Best regards, Luka AKA Spancek Unfortunately not. Do you know the folder the messages are in? If so, try a custom view instead. There is an addin called qsearc...

help with email
i am tring to get my email address sorted out, i have just got an email address through outlook and when i try to send an email it comes back with "please vertify the email address with your account properties" dont know what this means or what to do to fix it can anyone please help with this question? You don't get email addresses from Outlook. You get them from your service provider and set up the account in Outlook according to the server settings they give you. Look up 'Add email account' in Help. "lionpeach" wrote: > i am tring to get my ema...

Help with a simple query
Hi guys and gals, Can anyone help me with this query? I am having some issues with pulling in all names even though (it appears) I have the join correct. SELECT tblEmployee.EmpRptID, tblEmployee.UserName, Sum(tmpReports.NumOfSets) AS SumOfNumOfSets FROM tblEmployee LEFT JOIN tmpReports ON tblEmployee.UserName = tmpReports.UserName WHERE (((tblEmployee.IsCQATech)=True) AND ((tmpReports.CompleteDate) Between #2/8/2010# And #2/12/2010#)) GROUP BY tblEmployee.EmpRptID, tblEmployee.UserName; What am I doing wrong? You have defeated the left join by applying criteria to the right s...

Help with SUM command
Suppose that I have data in columns A1:A100 and B1:B100. I know that I how to sum up the totals from A1:A100. It's simply "=SUM(A1:A100)" . However, suppose that I want to divide this value by the sum of column B. In effect, I would like to find the value of SUM(A1:A100)/SUM(B1:B100) - How can this be accomplished in MS Excel? I am *NOT* interested in: 1. "=SUM(A1:A100)" entered in cell, C1, for example. 2. "=SUM(B1:B100)" entered in another cell, C2, for example. 3. In C3 typing in "=C1/C2". I AM INTERESTED IN A "ONE STEP COMMAND&quo...

XMLSerializer Serialize
Iam trying to create a xml file by serializing a custom business object. Iam using a xmltextwriter, but the problem there are invalid characters at the end of the generated file anyone knows a way around it ? tia Dim myStream As New IO.MemoryStream Dim myXMLWriter As New System.Xml.XmlTextWriter(myStream, System.Text.Encoding.UTF8) myXMLWriter.Formatting = System.Xml.Formatting.Indented Dim myShipments As OrderShipments myShipments = CType(myOrder.OrderAddresses(0), COrderAddress).Shipments myShipments.ToXML(myXMLWriter) ...