How to generate XML using ASP

Creating an xml file is a breeze using asp. To start with you have to set the ContentType of the document to text/xml in your code. The next step is to create an AspXml object. This can be done using the following code:

_______________________________________________


_______________________________________________

set aspxmlobj = Server.CreateObject("AspXml.AspXml")

Now you can create the root node with the code,

aspxmlobj.Tag = "name_of_root_node"

To start creating the first record, you can use the command,

set aspxmlobj = xml.NewChild("name_of_the_record", "")

Now to add the child elements to the new record, you can use,

aspxmlobj.NewChild2 "name_of_the_child", "value_of_the_child"

You can use the above command and keep on adding the additional child elements to the record. Now if you want to add another record you can do so by navigating to the parent node using,

aspxmlobj.GetParent2()

and start again with aspxmlobj.NewChild.

This way you can create all the records needed for the xml document use the aspxmlobj.GetXml() method to get the xml document created to be displayed. You can use the Response.Write method to display the xml document thus created.

CASE Software combines 5 development platforms in one. (ThomasNet)
Compatible with MS Visual Studio 2005/2008, ComponentOne Studio Enterprise 2008 v2 is comprised of Studio for WinForms, Studio for ASP.NET, Studio for WPF, Studio for Mobile, and Studio for ActiveX. Other components are included for viewing and adding context-sensitive help files in Windows Forms applications as well as creating and maintaining data-entry forms. Other features include ...

ComponentOne Announces the Release of Studio Enterprise v2 (PR Newswire via Yahoo! Finance)
ComponentOne continues its reign as the leader of components with its latest release of ComponentOne Studio Enterprise. ComponentOne Studio Enterprise is the industry's broadest and most complete suite of development components with five development platforms in one.

AjaxPDF 2.0 Adds Digital Signatures, Floating Windows and New Design Features for Displaying PDF Documents Online (PRWeb via Yahoo! News)
AjaxPDF extends its lead as the premiere ASP.NET PDF display solution with digital signatures plus hundreds of new display features. AjaxPDF is the easiest way to customize the online PDF document viewing, printing, form filling, saving, securing and signing experience.



FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

_______________________________________

Recommended XML Books

cover
cover
cover
cover
cover
cover




 

 

FREE Subscription

Stay Current With the Latest Technology Developments Realted to XML. Signup for Our Newsletter and Receive New Articles Through Email.

Name:

Email:

Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.

 

 

Add to My Yahoo!


New XML Books Titles - Best Seller's @ Amazon.com

Visit XML Training Material Guide Homepage

Technology helps engage students - how do classroom instruction and social dynamics change when the classroom is completely dependant on modern technology?

Dallas Web Design- local Dallas web design firm offers site design and backend system development