473,725 Members | 2,278 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 18 '05 #1
1 1748
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:u%******** ********@tk2msf tngp13.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 18 '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
7049
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.
1
2227
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.
6
10022
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
4507
by: viditmittal | last post by:
hi, i have a xml file <root> <Type /> <Description /> <Category /> <employee > <id>3</id>
1
13337
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
6805
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
1924
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
2622
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
8889
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
8752
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
9401
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
9257
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...
0
8099
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...
0
4519
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...
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.