Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > BOOK: Professional ASP.NET 2.0 XML
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 2.0 XML
This is the forum to discuss the Wrox book Professional ASP.NET 2.0 XML by Thiru Thangarathinam; ISBN: 9780764596773
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 2.0 XML 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 28th, 2007, 07:55 PM
Registered User
 
Join Date: Aug 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Bug in AirlineReservation

The method:

 void CreateXmlFile(string path)
    {
        StockDB stock = new StockDB();
        XmlDocument doc = stock.GetStockQuote("INTC");
        doc.Save(path);
    }

saves the Stocks.xml file in the following format:
<Stocks>
  <name>INTC</name>
  <price>96</price>
</Stocks>

while the file supplied is of this format
<Stocks name="INTC" price="96" />

Now if you create the XML File from the application; this line will not work
<asp:XmlDataSource runat="server" DataFile="~/App_Data/Stocks.xml" ID="XmlDataSource1" XPath="Stocks" /> You need to change the property XPath="Stocks" to XPath="price".

Please confirm if that is correct.

Reply With Quote
  #2 (permalink)  
Old February 21st, 2009, 06:49 PM
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default AirlineReservation Source Code

You have to create a xslt file to transform the xml file, remove the XPath property and add TransformFile="~/Stocks.xslt" in the GridView control. The Stocks.xslt file is as follows:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<Stocks>
<xsl:apply-templates select ="Stocks"/>
</Stocks>
</xsl:template>
<xsl:template match ="Stocks">
<Stocks>
<xsl:attribute name="name">
<xsl:value-of select="name"/>
</xsl:attribute>
<xsl:attribute name="price">
<xsl:value-of select="price"/>
</xsl:attribute>
</Stocks>
</xsl:template>
</xsl:stylesheet>
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

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
Bug or no to bug learning C using VS.Net to compil tesh All Other Wrox Books 0 February 14th, 2007 01:06 PM
Bug happens guoqi BOOK: ASP.NET Website Programming Problem-Design-Solution 0 October 13th, 2003 02:35 PM



All times are GMT -4. The time now is 07:14 PM.


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