Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 3.5 SP1 Edition: In C# and VB
This is the forum to discuss the Wrox book Professional ASP.NET 3.5 SP1 Edition: In C# and VB by Bill Evjen, Scott Hanselman, and Devin Rader; ISBN: 9780470478264
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 3.5 SP1 Edition: In C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 13th, 2010, 12:32 PM
Registered User
 
Join Date: Dec 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating XML with Linq To XML

Hello friends,
I am new to XML,so please help me out

Following is my code-->

try
{
Response.ContentType = "text/xml";

XNamespace ns = "http://example.books.com";
XDocument books = new XDocument(new XElement(ns + "bookstore",
new XElement(ns + "book",
new XAttribute("publication", "pub123"),
new XAttribute("ISBN", "123"),
new XElement(ns + "Title", "ASP.NET 4.0"),
new XElement(ns + "Price", "Rs 100"),
new XElement(ns + "Author",
new XElement(ns + "First-Name", "Anuj"),
new XElement(ns + "Last-Name", "Angural")))));


Response.Write(books);

}
catch (Exception ex)
{
Response.Write(ex.Message);

}

I am getting following error in IE--->

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Cannot have a DOCTYPE declaration outside of a prolog. Error processing resource 'http://localhost:3018/XML/Default2.aspx'....

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&...
 


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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
chp33 LINQ query Xml Document duce1nik BOOK: Professional C# 4.0 and .NET 4 1 April 15th, 2011 11:43 AM
Creating the dtsConfig xml robhale BOOK: Microsoft SQL Server 2008 Integration Services Problem-Design-Solution 1 August 22nd, 2010 12:12 AM
Reading author instances via LINQ to XML Listing10-10q workidoo BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 1 August 3rd, 2009 12:31 PM
Creating XML doc ; writing string(xml format) into KamalRaturi XML 5 May 28th, 2008 06:51 AM
creating a structured xml from an unstructured xml geoffgeoffgeoff XSLT 0 August 10th, 2005 03:58 PM



All times are GMT -4. The time now is 02:32 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.