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

XML Format

Hi ,
I have One XML File In That There Have One Parent Node Having Similar Name Of Multiple ChildNode
Eg:
Expand|Select|Wrap|Line Numbers
  1.  <entry>
  2.   <string>isprivacyprotectionallowed</string> 
  3.   <string>true</string> 
  4.  </entry>
  5.  <entry>
  6.   <string>registrantcontactgroup</string> 
  7.   <string>Contact</string> 
  8.  </entry>
I wanted To Bind XML File In Gridview
Please help me out. How can I Do this?

Thanks And Regards ,
Tushar
Dec 7 '11 #1
3 1437
Frinavale
9,735 Expert Mod 8TB
Use the XMLReader Class to populate a DataTable that you can use as the data source for your GridView.

For example:
(C#)
Expand|Select|Wrap|Line Numbers
  1. System.Data.DataTable dt = new System.Data.DataTable("Entries");
  2. System.Xml.XmlReader xr = System.Xml.XmlReader.Create("PathToXml/Entries.xml");
  3.  
  4. dt.ReadXmlSchema(xr);
  5. dt.ReadXml(xr);
  6.  
  7. xr.close();
  8.  
  9. myGridView.DataSource = dt;
  10. myGridView.DataBind();
(VB.NET)
Expand|Select|Wrap|Line Numbers
  1. Dim dt As New System.Data.DataTable("Entries")
  2. Dim xr As System.Xml.XmlReader = System.Xml.XmlReader.Create("PathToXml/Entries.xml")
  3.  
  4. dt.ReadXmlSchema(xr)
  5. dt.ReadXml(xr)
  6.  
  7. xr.close()
  8.  
  9. myGridView.DataSource = dt
  10. myGridView.DataBind()
-Frinny
Dec 7 '11 #2
I did that but because of String element it is Not working.

I will send whole XML here. Please check and give a solution.
Dec 8 '11 #3
Hi, please check attachment XMLForDomain.txt
Dec 8 '11 #4

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

Similar topics

3
by: Lowell Kirsh | last post by:
In Peter Norvig's Infrequently Answered Questions he explains that the following 2 fnctions look almost identical but are not the same: def printf(format, *args): print format % args, def...
15
by: Simon Brooke | last post by:
I'm investigating a bug a customer has reported in our database abstraction layer, and it's making me very unhappy. Brief summary: I have a database abstraction layer which is intended to...
3
by: stevek | last post by:
How do I format an integer. Add commas. 1234565 1,234,565 TIA
6
by: Dario Di Bella | last post by:
Hi all, we have the following urgent issue affecting our development team. Initially we had one particular workstation that failed executing queries on a DB2 database, raising an invalid date...
3
by: Melissa | last post by:
What specifically causes the Format event of a report's section to fire? Thanks! Melissa
11
by: Grumble | last post by:
Hello, I have the following structure: struct foo { char *format; /* format string to be used with printf() */ int nparm; /* number of %d specifiers in the format string */ /* 0 <= nparm <=...
1
by: Julius Fenata | last post by:
Dear all, I need help to change my item-template value format... Here is my case, I have a datagrid, with 'SubjectPrice' field, and when the grid displayed, my 'SubjectPrice' field displayed...
4
by: David Morris | last post by:
Hi Could somebody please explain what the following line of code means String.Format("{0}\{1}.{2:00}", C:\, myfile.txt, 1 It's actually the first argument that I don't understand. What is...
13
by: Roy | last post by:
Hi all, I'm creating a project that should always use this date format when displays the dates or create dates. The back end database is a SQL Server and I like to know what is the logical way...
3
by: Carl Trachte | last post by:
Hello. Python 3.0.a1 has been released. I'm trying to get the hang of the new string formatting in the form: '5.66' There are more options in PEP 3101 (fill, alignment, etc.), but I'm having...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.