472,805 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

Automatic XPath Query Generation

Hi All

I am trying to generate an XPath expression based on a xml input. The
generated XPath expression should then allow me find/detect that input
xml code fragment is present within a larger document. Can this be done
with XSLT?

I'm not looking for a full solution to this problem just some pointers
in the right direction.

thanks

Jun 24 '06 #1
2 1709
ad*****@googlemail.com wrote:
Hi All

I am trying to generate an XPath expression based on a xml input. The
generated XPath expression should then allow me find/detect that input
xml code fragment is present within a larger document. Can this be done
with XSLT?


A template for generating basic XPaths was one of the incidental things
I included in my "Styling Stylesheets" articles on IBM's DeveloperWorks
website's XML section (http://www.ibm.com/xml). As I noted there, it
cheats somewhat, in that it isn't handling namespaces properly. Since
then, I realized that I could solve that by using predicates... but the
resulting XPaths would not be very human-readable.

(Part of the problem is that XPath itself doesn't have any standard
syntax for defining prefixes, which is somewhat annoying.)
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 24 '06 #2
Joe Kesselman wrote:
A template for generating basic XPaths was one of the incidental things
I included in my "Styling Stylesheets" articles on IBM's DeveloperWorks
website's XML section (http://www.ibm.com/xml). As I noted there, it
cheats somewhat, in that it isn't handling namespaces properly. Since
then, I realized that I could solve that by using predicates... but the
resulting XPaths would not be very human-readable.


For convenience, the two-part article can be found at
http://www-128.ibm.com/developerwork...ss1/index.html
http://www-128.ibm.com/developerwork...ss2/index.html

The pseudo-XPath generator template is in part 2; see listing 4.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 26 '06 #3

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

Similar topics

0
by: Rasmus Fogh | last post by:
Someone raised the question of automatic code generation a few weeks back. And yes, we (CCPN) are using automatic Python code generation in a major way. Basically we are making data models in...
8
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...
15
by: Kannan Goundan | last post by:
Maintaining a C++ header file can be painful. I want a way to automatically generate header files from the implementation file. Does anybody know of a program that does this? If not, I'd like...
2
by: luke | last post by:
Hi, I am very new to xml. I have a datatable I need to group by and was suggested that xml and xpath might be the way to go. I converted the datatable to xml but don't know what to do next. Can...
3
by: Stefan Behnel | last post by:
Hi! I need to generate source code (mainly Java) from a domain specific XML language, preferably from within a Python environment (since that's where the XML is generated). I tried using...
4
by: Petterson Mikael | last post by:
Hi, Anyone out there that knows of a automatic test generation tool for cpp? Another requirement is that the test results should be presented in xml. All hints appreciated. cheers, ...
3
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...
3
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post by:
Hi; We have a TreeView that represents an xml file (or it's schema is a more accurate statement). We want to have a double click on a node in the tree generate the XPath to get to that node. ...
2
by: luthriaajay | last post by:
I need some help to extract the LatestFillQuantity element value using XPATH. in Java. I am unable to extract the value of 10000. Please help as to what have I done wrong.? Help appreciated. ...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.