473,837 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XQuery - data($node + $xpath) ?

103 New Member
Hi

I know the title's a bit odd. I'm trying to set up an XQuery for which the xpath is set previously according to input parameters.

If I was going to do this normally I'd do something like:

Expand|Select|Wrap|Line Numbers
  1. let $first := data($node//h2)
  2.  
And this would get the h2 tags from the node.

But I want to set $path= 'h2' before the xquery and then...

Expand|Select|Wrap|Line Numbers
  1. let $first := data($node$path)
  2.  
or I tried
Expand|Select|Wrap|Line Numbers
  1. let $first := data(concat($node,$path))
  2.  
Can anyone help? I think the problem is that $node is a node() type and $path is a string type so how can I join them in the same way as if I'd typed //h2?

Thanks in advance!
Dec 13 '07 #1
2 1743
jkmyoung
2,057 Recognized Expert Top Contributor
What this ends up being is an attempt to dynamically evaluate an xpath. Due to the way the majority of compilers for XQuery work, this isn't possible without the use of extension functions or other workarounds, which are often processor dependent.

What XQuery processor are you using?
Do you know the general structure of the xpath?
Dec 13 '07 #2
henryrhenryr
103 New Member
Hi - thanks for your reply!

What XQuery processor are you using?
I'm using web harvest - (http://web-harvest.sourcef orge.net). I've found most functions I've tried work - well they don't break it! Let me know which ones I should try and I'll give it a try.

Do you know the general structure of the xpath?
I'm not 100% sure what you mean here... I'm using XPath to read HTML sites. So the structure I'm trying to capture is pretty much standard (although normally messy) HTML.

I am using the software for a number of different sites and I want to have the same set of processors used for various tasks - I will input the XPath to identify particular parts of a node that I want but that varies between different tasks so I need a dynamic solution...

Hope that makes it clearer. Thanks for your help!
Dec 14 '07 #3

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

Similar topics

1
1415
by: Jeff Kish | last post by:
Hi. Can someone tell me when xslt, xpath, xquery are appropriate technologies to consider? I really know nothing about xslt except it is about transforming xml, (but I'm about to embark on a learning campaign). As you may have noticed from other postings, I know a very small amount about XQuery (and thus XPath).
7
1883
by: Zaharije Pasalic | last post by:
I tried to implement multi-data list with a reference instead of pointer to data, but code compiled with gcc perform "segmentation fault". Generated code from other compilers: Borland C++ 5.0 and Micros. C++ 6.0 is OK. What is wrong? #include <iostream> using namespace::std; class base {
1
1302
by: Omega375 | last post by:
Hello. I'll first start off by showing the structure of my xml-file. <root> <node path="X"> More nodes containing data </node> </root>
3
4840
by: Dinesh_GR | last post by:
Hi all, I have many parent tags and many child tags under the respective parent.. in an XML file. On the click of a button the application should pick up the one parent and the corresponding child and bind it to a grid. Like that it goes on for the next parent and the related child for the next button click.
1
2642
by: lg2530 | last post by:
template<class T> struct NODE { T data; NODE<T> * next; }; template<typename T> NODE<T>* QuickSortList( NODE<T>* list ) {}
4
6053
by: Steve Richter | last post by:
when I run the following code the leading spaces of the "data" node are removed. How do I retain whitespace? private void CreateBasicXmlDocument() { XmlWriterSettings writeSettings = new XmlWriterSettings(); writeSettings.Indent = true; XmlWriter writer = XmlWriter.Create( filePath, writeSettings );
3
3571
by: Bloody Viking | last post by:
Namaste, Y'all! I've got a valid XQuery expression that I need to convert to XPath 2.0. This expression will be stored in a resource file and applied to XML by a Java program with saxon8.jar (I'm pretty sure it's v.8.7). The manifest from the jar file follows: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.7.0 Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.) Project-Name: Saxon-B
1
1436
by: greg | last post by:
Hi All, In the following declaration of a node, do we need the second `struct': typedef struct Node { struct Elem* next; int data; } Node;
2
4723
by: arunairs | last post by:
Hi, Is there a way of validating and XPath? In this case , I am accepting an XPath from the user and I need to validate the XPath syntax. Is there a regular expression available that anyone can direct me to, to validate a XPath? thanks, Arun
0
10891
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
10582
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
10638
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
9418
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
7009
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
5677
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
5859
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4054
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3128
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.