Click here to Skip to main content
15,896,726 members
Home / Discussions / C#
   

C#

 
GeneralC# Photo Album Viewer - Need help, will pay. Pin
Joel Briggs19-Sep-03 6:09
Joel Briggs19-Sep-03 6:09 
GeneralRe: C# Photo Album Viewer - Need help, will pay. Pin
fadee20-Sep-03 1:37
fadee20-Sep-03 1:37 
GeneralResourceManager.GetString() unsafe Pin
berndg19-Sep-03 5:25
berndg19-Sep-03 5:25 
GeneralParent form / child form docking problems Pin
Member 54950419-Sep-03 4:37
Member 54950419-Sep-03 4:37 
Generalurgent help!! how to create form like project property page of CSharp project in a solution Pin
Maggiem19-Sep-03 4:12
Maggiem19-Sep-03 4:12 
GeneralRe: urgent help!! how to create form like project property page of CSharp project in a solution Pin
leppie19-Sep-03 7:08
leppie19-Sep-03 7:08 
GeneralHelp with Outlook Global Address List!!!! Pin
frank2119-Sep-03 3:39
frank2119-Sep-03 3:39 
GeneralDataGrid binding. Pin
kalla12319-Sep-03 2:26
kalla12319-Sep-03 2:26 
GeneralRe: DataGrid binding. Pin
Mazdak19-Sep-03 6:48
Mazdak19-Sep-03 6:48 
GeneralRe: DataGrid binding. Pin
Jim MacDonald19-Sep-03 9:44
Jim MacDonald19-Sep-03 9:44 
GeneralRe: DataGrid binding. Pin
kalla12319-Sep-03 10:01
kalla12319-Sep-03 10:01 
Generaltabcontrol Pin
brain2cpu18-Sep-03 23:49
professionalbrain2cpu18-Sep-03 23:49 
GeneralRe: tabcontrol Pin
NetPointerIN19-Sep-03 7:47
NetPointerIN19-Sep-03 7:47 
GeneralRe: tabcontrol Pin
brain2cpu23-Sep-03 20:08
professionalbrain2cpu23-Sep-03 20:08 
Generalmp3 calculations Pin
Uncle Monkey18-Sep-03 23:29
Uncle Monkey18-Sep-03 23:29 
GeneralRe: mp3 calculations Pin
Julian Bucknall [MSFT]19-Sep-03 6:33
Julian Bucknall [MSFT]19-Sep-03 6:33 
GeneralRe: mp3 calculations Pin
Uncle Monkey21-Sep-03 22:31
Uncle Monkey21-Sep-03 22:31 
GeneralRe: mp3 calculations Pin
Julian Bucknall [MSFT]22-Sep-03 5:25
Julian Bucknall [MSFT]22-Sep-03 5:25 
GeneralRe: mp3 calculations Pin
Uncle Monkey22-Sep-03 5:32
Uncle Monkey22-Sep-03 5:32 
Generali want to run the sqlserver agent server Pin
meetweb18-Sep-03 20:07
meetweb18-Sep-03 20:07 
GeneralProblem in accessing an unmanaged dll Pin
Rashi_Ajay18-Sep-03 19:34
Rashi_Ajay18-Sep-03 19:34 
GeneralHELP - Following XML Element Heirarchy Pin
Anonymous18-Sep-03 19:00
Anonymous18-Sep-03 19:00 
I have an XML file which has a depth of 4 elements:
-----------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<MutualFunds>
..<Fund>
....<FundName>Altamira Fund</FundName>
........<Holdings>
............<Company>
..................<CompanyName>The Procter &amp; Gamble Company</CompanyName>
..................<Symbol>PG</Symbol>
..................<Shares>13500</Shares>
............</Company>
........</Holdings>
....</FundName>
..</Fund>
..<Fund>
....<FundName>Lynch Fund</FundName>
........<Holdings>
............<Company>
..................<CompanyName>Gerber Foods</CompanyName>
..................<Symbol>GF</Symbol>
..................<Shares>13500</Shares>
............</Company>
........</Holdings>
....</FundName>
..</Fund>
</MutualFunds>
-----------------------------------------------

Im trying to read in this XML file and have it parsed so that the contents under <FundName> (Altamira Fund and Lynch Fund) appear in a combobox while its respective <Company>s under <Holdings> are preserved in an ArrayList so that when I select the Altamira Fund from the combobox its respective company's will appear in a ListView.

I've tried tackling this simple problem with:
=[1]=
DataSet ds = new DataSet("MyData");
ds.ReadXml("Holdings.xml");
DataTable t = ds.Tables["Fund"];
=======

=[2]=
XmlTextReader reader = new XmlTextReader("Holdings.xml");

While (!(reader.MoveToContent() == XmlNodeType.Element && reader.Name == "FundName"))
{
reader.ReadString();
}
======

In [1] i tried getting the DataSet to return back a the <Fund> element hoping that it would belong to the Altamira Fund group but it seems the Lynch Fund name was apart of this table. In [2] Im trying to iterate thru the nodes until i get to what I want then begin storing what i need then moving on to the next element. When a </Fund> is reached Ill know the next <Fund> is coming up.

Ideally i want to ask the XML reader to simply return back the <Fund> group of the "Altamira Fund" (which will contain the <FundName>Altamira Fund</FundName>, <Holdings>, and respective <Company> elements). It shouldnt include the other <Fund> in any way. Once I've processed this first fund then i can move on to the next with its respective childern. What Im see from DataSets is its clumping all similar tag contents together, so <Company>'s in both <Fund>s are being placed together. When it comes time to create my ComboBox with respective Company's the presented information will be incorrect. As for the MoveToContent iteration, it seems acceptable but a bit dirty.

Do i "need" to create an XML Schema or use DataRelations in any way?

Thanks.
GeneralRight Click on the internet explorer Pin
Srikar Y18-Sep-03 17:58
Srikar Y18-Sep-03 17:58 
GeneralRe: Right Click on the internet explorer Pin
Blake Coverett20-Sep-03 15:44
Blake Coverett20-Sep-03 15:44 
GeneralProblem with Object Serialization/Deserialization Pin
alreddawg1918-Sep-03 17:42
alreddawg1918-Sep-03 17:42 

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.