streaming xml???

Discussion in 'XML' started by dfetrow410@hotmail.com, Nov 3, 2005.

  1. Guest

    I am using a xsl template, but I need to create that on the fly into a
    stream. As well ast the xml file generated by the database. Can anyone
    help me. My working code is below....


    String conn = "Password=sa;User ID=sa;Initial Catalog=pubs;Data
    Source=xxxxxx";
    String sql = "Select * From Royalties ";
    String xslPath = "RoyaltyReportStyle.xsl";
    String ServerPath = HttpContext.Current.Server.MapPath("\\" +
    ConfigurationSettings.AppSettings["xmlPath"] + "\\");

    //Filter for a selected author
    //DataRowView item = (DataRowView)nameList.Items[index];
    String filter = "Karsen";

    //Get Royalty data
    SqlDataAdapter adapter = new SqlDataAdapter();
    SqlConnection connection = new SqlConnection(conn);
    SqlCommand command = new SqlCommand(sql + "where au_lname='" +
    filter + "'", connection);
    adapter.SelectCommand = command;
    DataSet data = new DataSet("root");
    adapter.Fill(data, "royalties");

    //Transform the data
    // string val = HttpContext.Current.Server.MapPath("\\" +
    ConfigurationSettings.AppSettings["xmlPath"] + "\\" + filter + ".xml");
    data.WriteXml(ServerPath + filter + ".xml");
    // data.WriteXml("C:\\Inetpub\\wwwroot\\excelTransform\\Karsen.xml");

    // Create a resolver with default credentials.
    XmlUrlResolver resolver = new XmlUrlResolver();
    resolver.Credentials =
    System.Net.CredentialCache.DefaultCredentials;

    // Create the XslTransform object.
    XslTransform xslt = new XslTransform();

    // Load the stylesheet.
    xslt.Load("http://localhost/excelTransform/RoyaltyReportStyle.xsl",
    resolver);

    // Transform the file.
    xslt.Transform(ServerPath + filter + ".xml", ServerPath + filter +
    "Report.xml", resolver);
     
    , Nov 3, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. clogwog
    Replies:
    0
    Views:
    447
    clogwog
    Oct 20, 2004
  2. Guillaume Dargaud

    Streaming xml questions

    Guillaume Dargaud, Feb 23, 2004, in forum: XML
    Replies:
    1
    Views:
    363
    Patrick TJ McPhee
    Feb 23, 2004
  3. Alain Frisch
    Replies:
    0
    Views:
    899
    Alain Frisch
    Jun 28, 2006
  4. TonyR

    xml streaming example

    TonyR, May 19, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    118
    TonyR
    May 19, 2005
  5. TonyR

    Streaming an XML using SOAP

    TonyR, May 5, 2005, in forum: ASP General
    Replies:
    0
    Views:
    129
    TonyR
    May 5, 2005
Loading...

Share This Page