473,387 Members | 1,463 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,387 software developers and data experts.

XML generation

Hi Guys,
I want to generate xml like:
Expand|Select|Wrap|Line Numbers
  1. <View>
  2.   <ID>1020</ID>
  3.   <NameList>
  4.      <Name>N1</Name>
  5.      <Name>N1</Name>
  6.   </NameList>
  7. <View>
  8.  
My Classes are :

Expand|Select|Wrap|Line Numbers
  1. public class NameList
  2.     {
  3.         public string Name;
  4.     }
  5.  
  6. public class View
  7.     {
  8.         private string ID;
  9.         private NameList[] nameList;
  10.         [XmlElement("ID", typeof(string))]
  11.         public string ID
  12.         {
  13.             get { return ID}
  14.             set { ID= value; }
  15.         }
  16.         [XmlElement("NameList", typeof(NameList))]
  17.         public NameList[] NameList
  18.         {
  19.             get { return nameList; }
  20.             set { nameList = value; }
  21.         }
  22.     }
  23.  
  24.  XmlSerializer serializer = new XmlSerializer(typeof(View));
  25.  
I am getting xml as:
Expand|Select|Wrap|Line Numbers
  1. <View>
  2.   <ID>1020</ID>
  3.   <NameList>
  4.      <Name>N1</Name>
  5.   </NameList>
  6.   <NameList>
  7.      <Name>N1</Name>
  8.   </NameList>
  9. <View>
  10.  
Please help in fixing this.

Thanks,
Aug 9 '13 #1
0 887

Sign in to post your reply or Sign up for a free account.

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
8
by: Max M | last post by:
Yesterday there was an article on Slashdot: http://books.slashdot.org/article.pl?sid=03/09/04/1415210&mode=flat&tid=108&tid=126&tid=156 It is about automatic code generation. I got interrested...
0
by: Rasmus Fogh | last post by:
Someone raised the question of automatic code generation a few weeks back. And yes, we (CCPN) are using automatic Python code generation in a major way. Basically we are making data models in...
8
by: | last post by:
Wel, I am rebuilding the VC# 2002 project that I have deployment problems with the 2003 version, hoping this solves the problems, but now I encounter this wierd bug??? If I have the project, and...
9
by: Hayato Iriumi | last post by:
Hello, I hear some hypes about creating code to generate C# or VB .NET code, that is, code generation (sounds straight forward enough). I haven't really seen how it's done in real world. I'm...
1
by: George Meng | last post by:
I want to evaluate some code generation tool for my company. Want to get some idea from you. The bottom line is I want to get a tool to generate both store procedure as well as business object...
3
by: Eddy Ilg | last post by:
Hi, I would like to suppress .pyc generation or have the .pyc generation in a speical seperate root (I found something about PYCROOT). Has this been implemented yet? Is there an environment...
31
by: eliben | last post by:
Hello, In a Python program I'm writing I need to dynamically generate functions and store them in a dict. eval() can't work for me because a function definition is a statement and not an...
4
by: Troels Arvin | last post by:
Hello, We have started planning our DB2 generation 8 -9.1/9.5 upgrades, as April 30 2009 is no longer distant future (ordinary support for DB2 generation 8 on Linux/Unix/Windows==LUW will end on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.