473,698 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XPath AddSort Question

DN
I'd like to pass multiple attributes to XPath AddSort like:

expr = nav.Compile(str Query);
expr.AddSort(so rtArray, XmlSortOrder.As cending, XmlCaseOrder.No ne, "",
XmlDataType.Tex t);

But I get "Only objects returned from Compile() can be passed as input."

It works fine with a single field name or attribute, but I can't seem to
figure out how to pass multiple fields.

Any ideas?

Thanks
Nov 12 '05 #1
1 2225
I replied to this on another forum:

Hi,

you would need to concatenate the contents of multiple nodes using XPath's
concat function to create an XPath expression to be passed to the AddSort.
For example to sort by last name and first name

string key="concat(con cat(lastname,', '),firstname)";

Then pass this to the AddSort method. It will be evaluated as a string and
actual value will be used to sort nodes.

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

"DN" <as*****@hotmai l.com> wrote in message
news:ub******** ******@TK2MSFTN GP11.phx.gbl...
I'd like to pass multiple attributes to XPath AddSort like:

expr = nav.Compile(str Query);
expr.AddSort(so rtArray, XmlSortOrder.As cending, XmlCaseOrder.No ne, "",
XmlDataType.Tex t);

But I get "Only objects returned from Compile() can be passed as input."

It works fine with a single field name or attribute, but I can't seem to
figure out how to pass multiple fields.

Any ideas?

Thanks

Nov 12 '05 #2

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

Similar topics

0
1172
by: Mark | last post by:
Hi, I have a web service that returns some XML based on a query made by the client. The order of this data is important and as such I use the following code to achieve this: XPathNavigator xpnNavigator; xpnNavigator = xpdEventDocument.CreateNavigator(); xpnNavigator.MoveToRoot();
2
7046
by: Ben Fidge | last post by:
Is it possible to sort the result of an XPath "select" query? I need to return a subset of a large xml file, and XPath is the way to go. I'd like to sort this subset afterwards? This seems like a common task so should be quite trivial. I've seen the same thing done but by first pumping the subset into an XmlDocument then applying XSLT.
6
10019
by: Banski | last post by:
Hi, Im quite new to XML in .Net. Im getting values from an xml file using XPath and sorting as you see in the code below. I cant figure out how to get the value of date with GetAttribute. Hope that this short description if enough and you can help to sort out this problem. Thanks in advance banski
4
4505
by: viditmittal | last post by:
hi, i have a xml file <root> <Type /> <Description /> <Category /> <employee > <id>3</id>
1
1725
by: DN | last post by:
I'd like to pass multiple attributes to XPath AddSort like: expr = nav.Compile(strQuery); expr.AddSort(sortArray, XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Text); But I get "Only objects returned from Compile() can be passed as input." It works fine with a single field name or attribute, but I can't seem to figure out how to pass multiple fields.
1
13334
by: Loretta | last post by:
Given an XML node List with the individual nodes looking like the following, what kind of XPATH statement can I use to sort the nodes by element F8 and inside F8 by element F3? <OffNetworkRequestPackage> <Transaction> <OffNetworkRequest> <OffNetworkData> <UserEmail>loretta.pelisserok@getronics.com</UserEmail> <AdminEmail>NoEmail</AdminEmail>
3
6803
by: Goran Djuranovic | last post by:
Hi All, Does anyone know how to retreive deepest XPath value from XML document by using VB.NET? For example, if I had an XML file like this: <Root> <Customer> <Name>MyName</Name> </Customer> </Root> I would like to retreive "\Root\Customer\Name" out of it. Something like:
0
1923
by: Chazam | last post by:
What I'm Trying to do is sort By Date. I came up whith the idea of splite the date in year, month and day then sort them individualy. this work perfect in xsl <xsl:sort order ="descending" select="substring- after(substring-after(fechaInicio,'/'),'/')" /> <xsl:sort order ="descending" select="substring- before(fechaInicio,'/')" /> <xsl:sort order ="descending" select="substring- before(substring-after(fechaInicio,'/'),'/')" /> This came...
1
2621
by: Lou | last post by:
How do I create an xpath expression to return a sorted nodelist? I need the sort to be by the attribute value. Example, If I have an xml list of names with "lastName" as an attribute <name lastName="Smith" /> <name lastName="Brown" /> i want to get back a sorted nodelist Dim NodeSorted as xmlNodeList=NodeNameList.SelectNodes("Name
0
9160
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
9029
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
8897
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
8862
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7729
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
6521
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
4370
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...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2331
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.