IT Community - Software Programming, Web Development and Technical Support

Tips to write XML with attributes

This is a discussion on Tips to write XML with attributes within the XML and SOAP forums, part of the Web Development category; hi all TestTableAdapter testRegistryTableAdapter = new TestRegistryTableAdapter(); TestRegistryTestRegistryDataTable testRegistryDataTable = new TestRegistry.TestRegistryDataTable(); testRegistryDataTable = testRegistryTableAdapter.GetData(); XmlTextWriter writer = new XmlTextWriter(Server.MapPath(&...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > XML and SOAP

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 08-13-2007, 07:40 AM
smani smani is offline
D-Web Programmer
 
Join Date: Aug 2007
Posts: 56
smani is on a distinguished road
Post Tips to write XML with attributes

hi all

TestTableAdapter testRegistryTableAdapter = new TestRegistryTableAdapter();
TestRegistryTestRegistryDataTable testRegistryDataTable = new TestRegistry.TestRegistryDataTable();
testRegistryDataTable = testRegistryTableAdapter.GetData();

XmlTextWriter writer = new XmlTextWriter(Server.MapPath("example.xml"), null);

//Write the root element

writer.WriteStartElement("markers");

for (int i = 0; i < callRegistryDataTable.Count; i++)
{
writer.WriteStartElement("marker");
writer.WriteAttributeString("lat", testRegistryDataTable[i].Lat);
writer.WriteAttributeString("lng", testRegistryDataTable[i].Long);
writer.WriteEndElement();
}


writer.WriteEndElement();

//Write the XML to file and close the writer
writer.Close();


Regards
Manivannan.s
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-17-2007, 03:53 AM
it.wily it.wily is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
it.wily is on a distinguished road
Default Re: Tips to write XML with attributes

hi smani....

i saw your code...
i did'nt get the info your code exactly......

i am using C# .net(.net frame work 2.0), i haven't big idea about adapter also.... please tell me step by step what i do for this exactly....
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-20-2007, 11:11 PM
smani smani is offline
D-Web Programmer
 
Join Date: Aug 2007
Posts: 56
smani is on a distinguished road
Post Re: Tips to write XML with attributes

hi,
Here is the step's
I hope you are using visual studio 2005,
1.Create Dataset by clicking add new item on right click of your solution
2.open server explorer in view tab in vs2005.
3.drag and drop your table u need, it automatically create a adapter for your dataset.
4.create stored procedure there, if you need.(in my code i had used default function GetData())

5.now go to your aspx.cs page, import your adapter namespace by using keyword

Then use the above code,

In my above code
Wat i did was,
1.Created object for my adapter
TestTableAdapter testRegistryTableAdapter = new TestRegistryTableAdapter();

2.Table object, since my adapter function will return the result as table
TestRegistryTestRegistryDataTable testRegistryDataTable = new TestRegistry.TestRegistryDataTable();

3.now collecting the resultan data in my table
testRegistryDataTable = testRegistryTableAdapter.GetData();

i hope it may be useful for u

Regards
Manivannan.s
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-13-2007, 12:10 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Smile Re: Tips to write XML with attributes

Ya..nice example...

thankx a lot to u.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I write a file from JavaScript? itbarota HTML, CSS and Javascript Coding Techniques 5 10-26-2007 12:54 AM
What are the main attributes if test automation? devarajan.v Software Testing 2 07-27-2007 06:30 AM
If I ask you to write 'VI' editor in C++ - How you'll proceed? Sabari C and C++ Programming 0 07-23-2007 12:37 AM
Can I write sin(x) instead of Math.sin(x)? prasath Java Programming 2 07-20-2007 07:38 AM
What’s the difference between Response.Write() andResponse.Output.Write()? prasath ASP and ASP.NET Programming 1 07-19-2007 02:56 AM


All times are GMT -7. The time now is 09:07 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0