|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Reads XML node from App.Config and populates a ClassI got the following problem to solve, hope you can help me. I got a XML node in App.Conf; <CUSTOMERS> <CUSTOMER> <NAME =”Frank” /> <LASTNAME =”Smith”/> <AGE= 34 /> </CUSTOMER> <CUSTOMER> <NAME =”Lisa” /> <LASTNAME =”Tucker”/> <AGE= 42 /> </CUSTOMER> <CUSTOMERS/> I will like to populate a class called Customers that has the same structure than the XML node Customers, with all the Customer nodes. Is there any automated way to do this in the framework? Thanks very much PH wrote:
> I got a XML node in App.Conf; That is not well-formed XML at all, you can either have> <CUSTOMERS> > > <CUSTOMER> > > <NAME =”Frank” /> <CUSTOMER NAME="Frank" /> or <CUSTOMER> <NAME>Frank</NAME> > I will like to populate a class called Customers that has the same You can use the xsd.exe tool to infer a schema and generate a class, see> structure than the XML node Customers, with all the Customer nodes. > > Is there any automated way to do this in the framework? <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpconXMLSchemaDefinitionToolXsdexe.asp> Hi,
Why you use app.config? This file should content only the needed configuration for your app, no data. You can keep your data in a XML file that can be readed direcly in a dataset. -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "PH" <nospam@nospam.com> wrote in message news:001401c64397$a4b64850$0c01a8c0@m1... Hi guys;I got the following problem to solve, hope you can help me. I got a XML node in App.Conf; <CUSTOMERS> <CUSTOMER> <NAME ="Frank" /> <LASTNAME ="Smith"/> <AGE= 34 /> </CUSTOMER> <CUSTOMER> <NAME ="Lisa" /> <LASTNAME ="Tucker"/> <AGE= 42 /> </CUSTOMER> <CUSTOMERS/> I will like to populate a class called Customers that has the same structure than the XML node Customers, with all the Customer nodes. Is there any automated way to do this in the framework? Thanks very much You’re right.
It will be a XML file. Now, I want to populate a Class instead of a Dataset. Thanks _____ From: Ignacio Machin ( .NET/ C# MVP ) [mailto:ignacio.machin AT dot.state.fl.us] Posted At: Thursday, March 09, 2006 1:17 PM Posted To: microsoft.public.dotnet.languages.csharp Conversation: Reads XML node from App.Config and populates a Class Subject: Re: Reads XML node from App.Config and populates a Class Hi, Why you use app.config? This file should content only the needed configuration for your app, no data. You can keep your data in a XML file that can be readed direcly in a dataset. -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "PH" <nospam@nospam.com> wrote in message news:001401c64397$a4b64850$0c01a8c0@m1...Hi guys; I got the following problem to solve, hope you can help me. I got a XML node in App.Conf; <CUSTOMERS> <CUSTOMER> <NAME =”Frank” /> <LASTNAME =”Smith”/> <AGE= 34 /> </CUSTOMER> <CUSTOMER> <NAME =”Lisa” /> <LASTNAME =”Tucker”/> <AGE= 42 /> </CUSTOMER> <CUSTOMERS/> I will like to populate a class called Customers that has the same structure than the XML node Customers, with all the Customer nodes. Is there any automated way to do this in the framework? Thanks very much Hi,
What about a typed dataset? If not you would have to create the method to populate the collection of Customers , there is nothing in the framework to do that for you. -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "PH" <nospam@nospam.com> wrote in message news:003601c643a9$0e595f70$0c01a8c0@m1... You're right.It will be a XML file. Now, I want to populate a Class instead of a Dataset. Thanks ------------------------------------------------------------------------------ From: Ignacio Machin ( .NET/ C# MVP ) [mailto:ignacio.machin AT dot.state.fl.us] Posted At: Thursday, March 09, 2006 1:17 PM Posted To: microsoft.public.dotnet.languages.csharp Conversation: Reads XML node from App.Config and populates a Class Subject: Re: Reads XML node from App.Config and populates a Class Hi, Why you use app.config? This file should content only the needed configuration for your app, no data. You can keep your data in a XML file that can be readed direcly in a dataset. -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "PH" <nospam@nospam.com> wrote in message news:001401c64397$a4b64850$0c01a8c0@m1... Hi guys;I got the following problem to solve, hope you can help me. I got a XML node in App.Conf; <CUSTOMERS> <CUSTOMER> <NAME ="Frank" /> <LASTNAME ="Smith"/> <AGE= 34 /> </CUSTOMER> <CUSTOMER> <NAME ="Lisa" /> <LASTNAME ="Tucker"/> <AGE= 42 /> </CUSTOMER> <CUSTOMERS/> I will like to populate a class called Customers that has the same structure than the XML node Customers, with all the Customer nodes. Is there any automated way to do this in the framework? Thanks very much Ok I might use that.
Thanks Igancio. _____ From: Ignacio Machin ( .NET/ C# MVP ) [mailto:ignacio.machin AT dot.state.fl.us] Posted At: Thursday, March 09, 2006 4:05 PM Posted To: microsoft.public.dotnet.languages.csharp Conversation: Reads XML node from App.Config and populates a Class Subject: Re: Reads XML node from App.Config and populates a Class Hi, What about a typed dataset? If not you would have to create the method to populate the collection of Customers , there is nothing in the framework to do that for you. -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "PH" <nospam@nospam.com> wrote in message news:003601c643a9$0e595f70$0c01a8c0@m1...You’re right. It will be a XML file. Now, I want to populate a Class instead of a Dataset. Thanks _____ From: Ignacio Machin ( .NET/ C# MVP ) [mailto:ignacio.machin AT dot.state.fl.us] Posted At: Thursday, March 09, 2006 1:17 PM Posted To: microsoft.public.dotnet.languages.csharp Conversation: Reads XML node from App.Config and populates a Class Subject: Re: Reads XML node from App.Config and populates a Class Hi, Why you use app.config? This file should content only the needed configuration for your app, no data. You can keep your data in a XML file that can be readed direcly in a dataset. -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "PH" <nospam@nospam.com> wrote in message news:001401c64397$a4b64850$0c01a8c0@m1...Hi guys; I got the following problem to solve, hope you can help me. I got a XML node in App.Conf; <CUSTOMERS> <CUSTOMER> <NAME =”Frank” /> <LASTNAME =”Smith”/> <AGE= 34 /> </CUSTOMER> <CUSTOMER> <NAME =”Lisa” /> <LASTNAME =”Tucker”/> <AGE= 42 /> </CUSTOMER> <CUSTOMERS/> I will like to populate a class called Customers that has the same structure than the XML node Customers, with all the Customer nodes. Is there any automated way to do this in the framework? Thanks very much XML Serialization is what I’m looking for.
http://msdn.microsoft.com/library/?url=/library/en-us/cpguide/html/cpcon serialization.asp Thanks to all who’ve respond. _____ From: PH [mailto:nospam@nospam.com] Posted At: Thursday, March 09, 2006 4:28 PM Posted To: microsoft.public.dotnet.languages.csharp Conversation: Reads XML node from App.Config and populates a Class Subject: Re: Reads XML node from App.Config and populates a Class Ok I might use that. Thanks Igancio. _____ From: Ignacio Machin ( .NET/ C# MVP ) [mailto:ignacio.machin AT dot.state.fl.us] Posted At: Thursday, March 09, 2006 4:05 PM Posted To: microsoft.public.dotnet.languages.csharp Conversation: Reads XML node from App.Config and populates a Class Subject: Re: Reads XML node from App.Config and populates a Class Hi, What about a typed dataset? If not you would have to create the method to populate the collection of Customers , there is nothing in the framework to do that for you. -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "PH" <nospam@nospam.com> wrote in message news:003601c643a9$0e595f70$0c01a8c0@m1...You’re right. It will be a XML file. Now, I want to populate a Class instead of a Dataset. Thanks _____ From: Ignacio Machin ( .NET/ C# MVP ) [mailto:ignacio.machin AT dot.state.fl.us] Posted At: Thursday, March 09, 2006 1:17 PM Posted To: microsoft.public.dotnet.languages.csharp Conversation: Reads XML node from App.Config and populates a Class Subject: Re: Reads XML node from App.Config and populates a Class Hi, Why you use app.config? This file should content only the needed configuration for your app, no data. You can keep your data in a XML file that can be readed direcly in a dataset. -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "PH" <nospam@nospam.com> wrote in message news:001401c64397$a4b64850$0c01a8c0@m1...Hi guys; I got the following problem to solve, hope you can help me. I got a XML node in App.Conf; <CUSTOMERS> <CUSTOMER> <NAME =”Frank” /> <LASTNAME =”Smith”/> <AGE= 34 /> </CUSTOMER> <CUSTOMER> <NAME =”Lisa” /> <LASTNAME =”Tucker”/> <AGE= 42 /> </CUSTOMER> <CUSTOMERS/> I will like to populate a class called Customers that has the same structure than the XML node Customers, with all the Customer nodes. Is there any automated way to do this in the framework? Thanks very much
Other interesting topics
are all subclasses virtual (use vtables?)
Forevery() writable iterator mechanism in C# 3 How to prevent DataGrid cell editing ? Date format pattern for "03rd of April 2006" type date Trace debug for every method in code Using properties from a nested class Type Question Debugging a command line c# windows Application How to determine if a string in an array Programatically finding SMTP Server on local network |
|||||||||||||||||||||||