473,385 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 1728
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. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.