Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Silverlight XSD and datatable

Silverlight XSD and datatable

Scheduled Pinned Locked Moved XML / XSL
xmlcsharpdatabasewcfdesign
1 Posts 1 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mycroft Holmes
    wrote on last edited by
    #1

    I am using Silverlight 4 and WCF In the WCF I write a datatable to a stringreader and return the string to the UI. In the UI I need to turn the string into an object (Telerik datatable class) which requires that I read the elements to create the columns and the data to populate the rows. Problem is when the data has null values the xml does not get a full set of elements, the table is invalid in the UI. To solve this I want to include the schema in the string passed to the UI. However I cannot work out how to get the schema out of the xDocument. This receives the string and creates the xDocument, I then need to get the schema to create the columns

    void GenericProcedureCompleted(object sender, GenericProcedureCompletedEventArgs e)
    {
    svcClient.GenericProcedureCompleted -= new EventHandler<GenericProcedureCompletedEventArgs>(GenericProcedureCompleted);
    ShowError(e.sErrorMsg);
    if (!string.IsNullOrEmpty(e.Result))
    {
    System.IO.StringReader sr = new System.IO.StringReader(e.Result);
    XDocument xDoc = XDocument.Load(sr);
    CreateTable(xDoc);
    }
    }

    This is currently using the elements to create the table

    xEl = xDoc.Descendants("XMLData").ToList()[0];
    foreach (XElement xe in xEl.Elements())
    {
    oCol = new CTUI.Data.DataColumn();
    oCol.ColumnName = xe.Name.LocalName;
    oCol.DataType = typeof(string);
    dtData.Columns.Add(oCol);
    }

    Ant suggestions that are valid for Silverlight 4 will be welcome. Note Silverlight 4 does not support all xml structures.

    Never underestimate the power of human stupidity RAH

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups