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

xpath query problem

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 30 '08 #1
3 809
hi to all,

i am new to this forum and also new to xml too...

i have an xml query to select a list of values...

XmlNodeList nl=doc.SelectNodes("//group[@group_name='Friends']/@group_name")

it can select only the node having value as Friends

i want to generalize the query by substituting a variable in place of 'Friends'

how can i do .....
pls guide me
Feb 4 '08 #2
hi to all,

i am new to this forum and also new to xml too...

i have an xml query to select a list of values...

XmlNodeList nl=doc.SelectNodes("//group[@group_name='Friends']/@group_name")

it can select only the node having value as Friends

i want to generalize the query by substituting a variable in place of 'Friends'

how can i do .....
pls guide me

Can u send full code,then it is to run and find exactly
..
Ajay
Feb 5 '08 #3
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
Hi,
I've some db't is SelectNodes working for the abue xml query?
bye using SelectSingleNode,it giving result only one value..
so u send full logic code then, i can try in my system ..
Feb 5 '08 #4

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

Similar topics

1
by: Chris | last post by:
Hi all, I have recently started working with the new XML functionality in PHP5, but I am running into a few problems. Specifically, I am using an Xpath query to try and pull out the data in...
6
by: 0wl | last post by:
Hi, I am trying to get the value of child from xmlstr = """<p:root xmlns:p="http://tempuri.org/string"><p:child DataType="String">Hellpppp</p:child></p:root>""" using...
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...
1
by: david_b_mcconnell | last post by:
Hi, I am having a problem using XPath when I validate Xml documents with a schema. Basically what happens is that an XPath query doesn't return the nodes I require if a schema is used to validate...
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...
2
by: ree32 | last post by:
When I import an xml document in Visual studio and Genereate as schema from it, and create a dataset from it, it adds this line into to the root element of my xml file -...
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>
6
by: dotnetnoob | last post by:
i would like to know how i can build xpath expression dynamiclly. let's say i have a following xml file: <EventEnrollment InstanceNumber = "675"> <EventSource> <ObjectReference...
2
by: Riki | last post by:
I'm stuck with an XPath query to produce a TreeView. From the data below, I want to select all the score elements having an IdIn of 2018, ***including their ancestors***. With the result, I want...
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: 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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.