473,327 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

How to get grouping..

I'm not sure if this is the right forum to ask this.
I make a XML code snippet to simplify my own problem.

-- code snippet start ------
sXml =
"<Depart>
<employee id='1' name='abc' amount='10' />
<employee id='1' name='abc' amount='20' />
<employee id='1' name='abc' amount='30' />
<employee id='2' name='fgh' amount='5' />
<employee id='2' name='fgh' amount='100' />
<employee id='3' name='xyz' amount='10' />
</Depart>"

XmlDocument doc = new XmlDocument();
doc.LoadXml(sXml);

string xPathQuery = "???????";
XmlNodeList nodes = doc.SelectNodes(xPathQuery);

----

I made XmlDocument from this XML string.
In first, I want to get employee list.
abc, fgh, xyz

Finally, the job is to get the following result.
Name # Total
abc 3 60
fgh 2 105
xyz 1 10

Can I do this jobs by XPath? Or Do I have to use others?
If so, what ?
Thanks,
jongmin

Nov 12 '05 #1
1 1132
Hi,

check these:
http://aspalliance.com/34
http://aspalliance.com/33

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

<an*******@discussions.microsoft.com> wrote in message
news:0a****************************@phx.gbl...
I'm not sure if this is the right forum to ask this.
I make a XML code snippet to simplify my own problem.

-- code snippet start ------
sXml =
"<Depart>
<employee id='1' name='abc' amount='10' />
<employee id='1' name='abc' amount='20' />
<employee id='1' name='abc' amount='30' />
<employee id='2' name='fgh' amount='5' />
<employee id='2' name='fgh' amount='100' />
<employee id='3' name='xyz' amount='10' />
</Depart>"

XmlDocument doc = new XmlDocument();
doc.LoadXml(sXml);

string xPathQuery = "???????";
XmlNodeList nodes = doc.SelectNodes(xPathQuery);

----

I made XmlDocument from this XML string.
In first, I want to get employee list.
abc, fgh, xyz

Finally, the job is to get the following result.
Name # Total
abc 3 60
fgh 2 105
xyz 1 10

Can I do this jobs by XPath? Or Do I have to use others?
If so, what ?
Thanks,
jongmin


Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Debbie Davis | last post by:
Hi there, SQL 2000 I have the following query: SELECT sponsor, COUNT(sponsor) * 2 AS total FROM Referrals GROUP BY sponsor Works great, returns the sponsor and the total * 2 of their...
3
by: Graham | last post by:
Hi, I am having trouble getting XSL to count the members of a group. What I am trying to do is group by <objectid.Contactid> and count the number of <activityid>'s for each <objectid.contactid>....
1
by: amber | last post by:
Hello, I have a report in VB.NET/Crystal Reports. I have a criteria form that users select between 2 different types of grouping (group by category or group by year). Can I programmatically...
2
by: Andreas Håkansson | last post by:
Seeing how my previous post seem to have fallen between the cracks, I thought I would have a second, more direct, go at it. So my question is "Is it possible to group (Muenchian method) over...
3
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
0
by: Corey | last post by:
hello, I’m trying to run a query and I’m getting error messages Can anyone help me get though this problem? 1: Tried this and got this error message ORA-00923 , decode...
0
by: Roman Bertle | last post by:
Hello, I try to format monetary values using the locale module, python2.5: Python 2.5.2a0 (r251:54863, Jan 3 2008, 17:59:56) on linux2 Type "help", "copyright", "credits" or "license" for...
1
by: Sandeep Singh | last post by:
Hi, How to do group by in XSLT ? I tried on the following codes: <files> <file name="swablr.eps" size="4313" project="mars"/> <file name="batboy.wks" size="424" ...
6
patjones
by: patjones | last post by:
Good afternoon: This seems like it shouldn't be hard, and then again this is how so many problems seem at the outset. My situation is this: I have a report called rptMain319, which is based...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.