Connecting Tech Pros Worldwide Help | Site Map

XML fille to List<>

muquaddim@gmail.com
Guest
 
Posts: n/a
#1: Jun 27 '08
Hello,
I have a xml file like the following.

<?xml version="1.0">
<data>
<idef units="Vin,Vout,E">
<i id="i1">
<sample num="1">
<sampledata value="2;3;7" />
</sample>
<sample num="2">
<sampledata value="8;1;7" />
</sample>
</i>
<i id="i33"<!-- The Id is totally random -->
<sample num="1">
<sampledata value="2;3;7" />
</sample>
<sample num="2">
<sampledata value="6,2,5" />
</sample>
</i>
<s id="s1">
<sample num="1">
<sampledata value="2" unit="k" />
</sample>
<sample num="2">
<sampledata value="8" unit="k" />
</sample>
</s>
<s id="s2"><!-- The Id is totally random -->
<sample num="1">
<sampledata value="7" unit="k" />
</sample>
<sample num="2">
<sampledata value="8" unit="k" />
</sample>
</s>
<e id="Ea">
<sample num="1">
<sampledata value="9" unit="k" />
</sample>
<sample num="2">
<sampledata value="4" unit="k" />
</sample>
</e>
<e id="Eb">
<sample num="1">
<sampledata value="1" unit="k" />
</sample>
<sample num="2">
<sampledata value="8" unit="k" />
</sample>
</e>
</data>

Now I want to parse it and make 10 List<from these.
Lists are ,
Ea: 9,4
Eb: 1,8
s1: 2,8
s2: 7,8
i1-Vin: 2,8
i1-Vout:3,1
i1-E:7,7
i33-Vin: 2,6
i33-Vout:3,2
i33-E:7,5

How to do this?
What library should I use? is there any standard way to do this?
Its a C# desktop application. Is there any way to directly use the
xml file as multiple datasource??
I need something which is faster. Casue the file is way too large
15MB.
Thanks
Martin Honnen
Guest
 
Posts: n/a
#2: Jun 27 '08

re: XML fille to List<>


muquaddim@gmail.com wrote:
Quote:
Hello,
I have a xml file like the following.
>
<?xml version="1.0">
<data>
<idef units="Vin,Vout,E">
<i id="i1">
<sample num="1">
<sampledata value="2;3;7" />
</sample>
<sample num="2">
<sampledata value="8;1;7" />
</sample>
</i>
<i id="i33"<!-- The Id is totally random -->
<sample num="1">
<sampledata value="2;3;7" />
</sample>
<sample num="2">
<sampledata value="6,2,5" />
</sample>
</i>
<s id="s1">
<sample num="1">
<sampledata value="2" unit="k" />
</sample>
<sample num="2">
<sampledata value="8" unit="k" />
</sample>
</s>
<s id="s2"><!-- The Id is totally random -->
<sample num="1">
<sampledata value="7" unit="k" />
</sample>
<sample num="2">
<sampledata value="8" unit="k" />
</sample>
</s>
<e id="Ea">
<sample num="1">
<sampledata value="9" unit="k" />
</sample>
<sample num="2">
<sampledata value="4" unit="k" />
</sample>
</e>
<e id="Eb">
<sample num="1">
<sampledata value="1" unit="k" />
</sample>
<sample num="2">
<sampledata value="8" unit="k" />
</sample>
</e>
</data>
>
Now I want to parse it and make 10 List<from these.
Lists are ,
Ea: 9,4
Eb: 1,8
s1: 2,8
s2: 7,8
i1-Vin: 2,8
i1-Vout:3,1
i1-E:7,7
i33-Vin: 2,6
i33-Vout:3,2
i33-E:7,5
Sorry, I don't see how these "lists" relate to the input XML.
What kind of lists do you want to create? List<int>?
What is Ea or Eb, part of a list, or some kind of variable name for a list?
Quote:
How to do this?
Well the .NET framework has the low level but fast forwards only
XmlReader API to parse XML. Then it has XPathDocument/XPathNavigator for
XPath 1.0 based reading and navigation. .NET 3.5 also has LINQ to XML.

Quote:
I need something which is faster. Casue the file is way too large
15MB.
Faster than what?


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
muquaddim@gmail.com
Guest
 
Posts: n/a
#3: Jun 27 '08

re: XML fille to List<>


On Jun 15, 7:09 am, Martin Honnen <mahotr...@yahoo.dewrote:
Quote:
muquad...@gmail.com wrote:
Quote:
Hello,
I have a xml file like the following.
>
Quote:
<?xml version="1.0">
<data>
<idef units="Vin,Vout,E">
<i id="i1">
<sample num="1">
<sampledata value="2;3;7" />
</sample>
<sample num="2">
<sampledata value="8;1;7" />
</sample>
</i>
<i id="i33"<!-- The Id is totally random -->
<sample num="1">
<sampledata value="2;3;7" />
</sample>
<sample num="2">
<sampledata value="6,2,5" />
</sample>
</i>
<s id="s1">
<sample num="1">
<sampledata value="2" unit="k" />
</sample>
<sample num="2">
<sampledata value="8" unit="k" />
</sample>
</s>
<s id="s2"><!-- The Id is totally random -->
<sample num="1">
<sampledata value="7" unit="k" />
</sample>
<sample num="2">
<sampledata value="8" unit="k" />
</sample>
</s>
<e id="Ea">
<sample num="1">
<sampledata value="9" unit="k" />
</sample>
<sample num="2">
<sampledata value="4" unit="k" />
</sample>
</e>
<e id="Eb">
<sample num="1">
<sampledata value="1" unit="k" />
</sample>
<sample num="2">
<sampledata value="8" unit="k" />
</sample>
</e>
</data>
>
Quote:
Now I want to parse it and make 10 List<from these.
Lists are ,
Ea: 9,4
Eb: 1,8
s1: 2,8
s2: 7,8
i1-Vin: 2,8
i1-Vout:3,1
i1-E:7,7
i33-Vin: 2,6
i33-Vout:3,2
i33-E:7,5
>
Sorry, I don't see how these "lists" relate to the input XML.
What kind of lists do you want to create? List<int>?
What is Ea or Eb, part of a list, or some kind of variable name for a list?
>
Quote:
How to do this?
>
Well the .NET framework has the low level but fast forwards only
XmlReader API to parse XML. Then it has XPathDocument/XPathNavigator for
XPath 1.0 based reading and navigation. .NET 3.5 also has LINQ to XML.
>
Quote:
I need something which is faster. Casue the file is way too large
15MB.
>
Faster than what?
>
--
>
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

By the following,
s2: 7,8
i1-Vin: 2,8
I meant

List<ints2;
List<inti1_Vin;

I need it .net 1.1 dependent hardly 2.0 (if I don't find any way ).

I was thinking if there is any tool or api which will directly output
List<>. and I'll give the description of the xml data. May be in xml
format.

Thanks for the XPathDocument/XPathNavigator names.
I'll check if that works for me.
Joe Fawcett
Guest
 
Posts: n/a
#4: Jun 27 '08

re: XML fille to List<>



<muquaddim@gmail.comwrote in message
news:15c91af1-9eb8-4a20-9a25-e252a9e34a31@d77g2000hsb.googlegroups.com...
Quote:
On Jun 15, 7:09 am, Martin Honnen <mahotr...@yahoo.dewrote:
Quote:
>muquad...@gmail.com wrote:
Quote:
Hello,
I have a xml file like the following.
>>
>
List<ints2;
List<inti1_Vin;
>
I need it .net 1.1 dependent hardly 2.0 (if I don't find any way ).
>
..NET 1.1 doesn't support generics so you can't use 1.1 and List<T>.

--

Joe Fawcett (MVP - XML)

http://joe.fawcett.name


Closed Thread