473,791 Members | 2,827 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 1740
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
1412
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
1881
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
1301
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
4839
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
3568
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
1433
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
9515
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
10207
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
9993
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
9029
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
7537
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
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4109
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
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2913
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.