473,385 Members | 1,337 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,385 software developers and data experts.

i have aproblem with xpath query in .net

hi all,
i am new to .net i have problem
i have an xml fille lik this:::

<?xml version="1.0" encoding="utf-8"?>
<personal_info>
<personal_id ID="1">
<name first_name="rajasekhar" middle_name="siva" last_name="aluru" nick_name="sekhar" />
<gender value="Male" />
<group group_name="bestfriends" parent_group="Friends" />
</personal_id>
<personal_id ID="2">
<name first_name="kiran" middle_name="kumar" last_name="karanam" nick_name="kiran" />
<gender value="Male" />
<group group_name="xyz company" parent_group="Collegues" />
</personal_id>
</personal_info>


from this file how can select the only the parent_group which are not sub gruops. i.e first lebel parent groups.....

i have used following query .....
//group[@group_name != @parent_group]

i am getting the following result
bestfriends
collegues
friends

but i need oonly,

collegues
friends

please any one can guide me
Jan 29 '08 #1
3 994
DrBunchman
979 Expert 512MB
I'm not 100% sure I understand what you're asking but if you change your XPath query to the following:

Expand|Select|Wrap|Line Numbers
  1. //group[@group_name != @parent_group]/@parent_group
It will only select the parent groups. Is this what you are looking for?

Dr B
Jan 29 '08 #2
I'm not 100% sure I understand what you're asking but if you change your XPath query to the following:

Expand|Select|Wrap|Line Numbers
  1. //group[@group_name != @parent_group]/@parent_group
It will only select the parent groups. Is this what you are looking for?

Dr B



Thanks a lot my problem has been solved.. i got the result exactly what i am looking for....
Jan 30 '08 #3
[quote=rajasekharsiva]

still i am not getting the desired result
Jan 30 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Terry P | last post by:
Are there any tools (java classes, tag libraries) which can translate xpath statements into a SQL query? Given an xpath query which has a predicate that filters node values or attributes, I want...
7
by: Ot | last post by:
I posted this to the wrong group. It went to m.p.dotnet.languages.vb. Ooops. -------------------------------------------------------------------- I have this tiny problem. I have learned...
5
by: Gnic | last post by:
Hi , I have an XmlDocument instance, I want to find a node in the xml, but I don't know it's path until runtime, for example <aaa> <bbb name="x"/> <aaa attr="y"> <ccc>sometext</ccc> </aaa>
3
by: Jason Mobarak | last post by:
Hello -- I'm attempting to get a handle on how to do xpath queries with System.Xml -- so far the biggest hurdle has been how to deal with a default namespace. If I use the test xml: <?xml...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

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.