Maybe this is a dumb question but how do I rename the elements in my
dataset?
What would the syntax look like for the XSLT option?
Also, is there a shorter way to type that out for each field other than
ds.Tables[0].Columns[0].ColumnName["CustID"] , like; DataTable dTable =
new DataTable(ds.Tables[0]) ?
Yes this is awesome.
Okay, the easiest possible approach since your XML and Dataset are
almost a 1 to 1 mapping - name the elements in your dataset to what you
expect them to look like in the XML document, i.e. instead of
ds.Tables[0].Columns[0].ColumnName being CustID, name it to Customer ID
.. (you can alternately do this using ColumnMappings when you would
have filled your dataaset).
If that doesn't work for you, your other option is to get the data out
of the dataset as XML and then updating the nodenames via XSLT or
otherwise.
Note, in this sense, you aren't really "loading" an XML document, but
creating it from the dataset.
- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
Thanks for the quick reply:
so I don't past too much text, here is part of the Dataset XML
<CustID>1223458</CustID>
<CustFName>Randy</CustFName>
My XML document has empty elements
<CustomerId></CustomerId>
<FirstName></FirstName>
I want to place the data into the porper element and save the XML
document
Hope this is enough info for you
qb
I'd love to help you, but I can't understand this code here --
EX: Data filedName = CustID XML document element string =
CustomerID
Any chance I could see your dataset contents (just do a
dataset.getxml() and paste the xml), and also your desired XML
structure and what you have in the XML doucment right now?
- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
I'm just getting my feet wet with .Net;
What I'm trying to do is load field data from a dataset into an XML
document using c#
EX: Data filedName = CustID XML document element string =
CustomerID
I have the dataset loaded and the xml document loaded, but can't get
the data into the proper element and save the updated XML doc.
Thanks in advance!!!!!
qb