Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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"&...




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 10:43 AM
Creating the dtsConfig xml robhale BOOK: Microsoft SQL Server 2008 Integration Services Problem-Design-Solution 1 August 21st, 2010 11:12 PM
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 11:31 AM
Creating XML doc ; writing string(xml format) into KamalRaturi XML 5 May 28th, 2008 05:51 AM
creating a structured xml from an unstructured xml geoffgeoffgeoff XSLT 0 August 10th, 2005 02:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.