Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
Generalshow a graph software Pin
visualgraph9-Sep-08 15:25
visualgraph9-Sep-08 15:25 
QuestionN70 NOKIA symbian mobile Pin
nelsonpaixao9-Sep-08 14:00
nelsonpaixao9-Sep-08 14:00 
AnswerRe: N70 NOKIA symbian mobile Pin
Christian Graus9-Sep-08 14:04
protectorChristian Graus9-Sep-08 14:04 
GeneralRe: N70 NOKIA symbian mobile Pin
nelsonpaixao9-Sep-08 14:58
nelsonpaixao9-Sep-08 14:58 
GeneralRe: N70 NOKIA symbian mobile Pin
Christian Flutcher9-Sep-08 18:44
Christian Flutcher9-Sep-08 18:44 
AnswerRe: N70 NOKIA symbian mobile Pin
Eslam Afifi9-Sep-08 15:26
Eslam Afifi9-Sep-08 15:26 
AnswerRe: N70 NOKIA symbian mobile Pin
nelsonpaixao10-Sep-08 12:41
nelsonpaixao10-Sep-08 12:41 
QuestionDataset to XML Pin
Ian Jacobs9-Sep-08 12:25
Ian Jacobs9-Sep-08 12:25 
Hello All,

I am having some trouble taking data from my Dataset and transforming into an XML document that has the proper formatting. I'm hoping someone here may have had similar trouble in the past.

(All names have been changed to protect the innocent Smile | :) )

What I want get when everything is said and done is the following:


<ResidentTransactions>
<Account>
<Customer>
<ServiceTransactions>
<Transactions>
<Charge>
<Detail>
<Description>Trash pick-up</Description>
<TransactionDate>2008-08-01</TransactionDate>
<ChargeCode>trash</ChargeCode>
<CustomerID>#########</CustomerID>
<Amount>12.00</Amount>
<Comment>Trash (08/2008)</Comment>
<PropertyPrimaryID>TestProp1</PropertyPrimaryID>
</Detail>
</Charge>
</Transactions>
<Transactions>
.
.
.
</Transactions>
</ServiceTransactions>
</Customer>
</Account>
</ResidentTransactions>


What I am getting is basically ignoring all the nesting, and just grabbing the innermost table with the actual data:


<ResidentTransactions>
<Detail>
<Description>Trash pick-up</Description>
<TransactionDate>2008-08-01</TransactionDate>
<ChargeCode>trash</ChargeCode>
<CustomerID>########</CustomerID>
<Amount>12.00</Amount>
<Comment>Trash (08/2008)</Comment>
<PropertyPrimaryID>TestProp1</PropertyPrimaryID>
</Detail>
<ResidentTransactions>


The code below is what is loading the data into the dataset:


SqlDataAdapter Da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
ds.ReadXmlSchema(@"C:\DEV\Schemas\BillingData.xsd");
Da.Fill(ds, "Detail");


When writing the XML I do the following:


StringWriter source = new StringWriter();
XmlDocument SourceXml = new XmlDocument();
XmlDocument RetXml = new XmlDocument();
ds.WriteXml(source,XmlWriteMode.IgnoreSchema);
SourceXml.LoadXml(source.ToString());


I believe it may have something to do with the fact that the outermost elements don't contain any data, they just contain the sub elements. When I render the XML, those "tables" in the dataset don't actually have any data to grab. In the last few days I haven't been able to come up with a solution though, and I really don't want to piece together a big string unless I have to.

Anything that may point me in the right direction would be greatly appreciated.

Thank you,
-Ian Jacobs


[EDIT] Removed an ID code I missed on the 1st pass
AnswerRe: Dataset to XML Pin
leppie9-Sep-08 21:47
leppie9-Sep-08 21:47 
GeneralRe: Dataset to XML Pin
Ian Jacobs10-Sep-08 2:39
Ian Jacobs10-Sep-08 2:39 
QuestionSwitch Statement Question Pin
Kevin Marois9-Sep-08 10:04
professionalKevin Marois9-Sep-08 10:04 
AnswerRe: Switch Statement Question Pin
Manas Bhardwaj9-Sep-08 10:20
professionalManas Bhardwaj9-Sep-08 10:20 
AnswerRe: Switch Statement Question Pin
DaveyM699-Sep-08 10:44
professionalDaveyM699-Sep-08 10:44 
Answer[Message Deleted] Pin
Blue_Boy9-Sep-08 11:54
Blue_Boy9-Sep-08 11:54 
GeneralRe: Switch Statement Question Pin
Guffa9-Sep-08 12:06
Guffa9-Sep-08 12:06 
GeneralRe: Switch Statement Question Pin
Blue_Boy10-Sep-08 6:41
Blue_Boy10-Sep-08 6:41 
GeneralRe: Switch Statement Question Pin
Christian Graus9-Sep-08 12:34
protectorChristian Graus9-Sep-08 12:34 
GeneralRe: Switch Statement Question Pin
Blue_Boy10-Sep-08 6:43
Blue_Boy10-Sep-08 6:43 
QuestionRe: Switch Statement Question Pin
leppie9-Sep-08 21:48
leppie9-Sep-08 21:48 
AnswerRe: Switch Statement Question Pin
Blue_Boy10-Sep-08 6:44
Blue_Boy10-Sep-08 6:44 
AnswerRe: Switch Statement Question Pin
Monark10-Sep-08 14:24
Monark10-Sep-08 14:24 
QuestionExport datagrid to excel Pin
Twyce9-Sep-08 10:04
Twyce9-Sep-08 10:04 
AnswerRe: Export datagrid to excel Pin
Manas Bhardwaj9-Sep-08 10:24
professionalManas Bhardwaj9-Sep-08 10:24 
AnswerRe: Export datagrid to excel Pin
Trushal1921-Sep-13 4:35
Trushal1921-Sep-13 4:35 
QuestionCrystal Report Help.. Pin
Slick699-Sep-08 10:01
Slick699-Sep-08 10:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.