![]() |
| | #1 |
| Registered User Join Date: Jul 2009
Posts: 2
| using xml data in codedom created class i'm creating c# class using codedom methods i have already generated: public class CRSHorizontalID { public class Norway { // value public const long name; } } bu the name of "public class Norway" should be read from xml document.. the name of class is in the xml node: <Country name="Norway" isoAlpha3="NOR" countryId="47" > does someone know how could i get the word "Norway" from xml(or xsd) to the: newClass = new CodeTypeDeclaration(className); ? thank you much |
| jimmi666 is offline | |
| | #2 |
| ...and never returned. Join Date: Aug 2009
Posts: 41
| Code: using System.Xml.Linq;
//...
string countryName =
doc.Element("RootElement").Elements("Country")
.Where(
p => (string)p.Attribute == (someId)
).Select(
p => (string)p.Attribute("name")
).SingleOrDefault();
newClass = new CodeTypeDeclaration(countryName);
Last edited by StainedBlue; 08-30-2009 at 11:07 AM. |
| StainedBlue is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Send data with class | Ducky | Networking/Device Communication | 6 | 08-08-2009 09:16 AM |
| Polymorphism Theory Question - Polymorphic Class Definition. | ventolin | C++ Programming | 3 | 10-31-2005 12:05 PM |
| VC++ Sending data from a structure in one class to a ListBox in a second class. | Burlock | Windows Programming | 1 | 11-23-2003 08:51 AM |
| can't insert data into my B-Tree class structure | daluu | C++ Programming | 0 | 12-05-2002 06:03 PM |
| structure vs class | sana | C++ Programming | 13 | 12-02-2002 07:18 AM |