473,770 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i have aproblem with xpath query in .net

7 New Member
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_inf o>
<personal_id ID="1">
<name first_name="raj asekhar" middle_name="si va" last_name="alur u" nick_name="sekh ar" />
<gender value="Male" />
<group group_name="bes tfriends" parent_group="F riends" />
</personal_id>
<personal_id ID="2">
<name first_name="kir an" middle_name="ku mar" last_name="kara nam" nick_name="kira n" />
<gender value="Male" />
<group group_name="xyz company" parent_group="C ollegues" />
</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 1007
DrBunchman
979 Recognized Expert Contributor
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
rajasekharsiva
7 New Member
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
rajasekharsiva
7 New Member
[quote=rajasekha rsiva]

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
7583
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 help constructing the Where clause of a SQL statement that will mirror the expressions and functions contained in the predicate. Such a tool may require an XML to DB mapping or it would need to make assumptions about the structure of the...
7
5496
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 that an xpath expression can be bounded by either single or double quotation marks. But sometimes I want to search for a title containing both a single and double quote. Any way to do this?
5
7932
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
4980
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 version="1.0" encoding="utf-8" ?> <thing xmlns="urn:thing-schema-v1"> <foo>foo thing</foo> <bar>bar thing</bar>
0
9618
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10101
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.