473,320 Members | 1,868 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,320 software developers and data experts.

Querying XML

Hi

I'm completely new to the XML world (yes, welcome to the 21st
century!) and am working on a project where I will be supplied a daily
xml document that needs to be queried.

The scenario is that I'm working for a recruitment company and they
want a simple website interface where users can browse their vacancies
by clicking through several options - e.g. Click on their choice of
location, then click on salary range, then job type. So I need the
"search results" page to show the relevant vacancies according to what
they've clicked.

I'm able to do this easily enough in php/mySQL, but not sure how to
work with XML. I've read up a bit on XPath, but not seen any examples
of how to show the results of *multiple* search criteria, like in SQL:
SELECT * FROM table WHERE salary=X AND location=Y AND job_type=Z

Are there any useful tutorials on this kind of thing, or is anyone out
there able to shed some light? I'll be working in a PHP5 environment.

Thanks
Warren

Jun 19 '07 #1
3 1406
wa*******@googlemail.com wrote:
I'm able to do this easily enough in php/mySQL, but not sure how to
work with XML. I've read up a bit on XPath, but not seen any examples
of how to show the results of *multiple* search criteria, like in SQL:
SELECT * FROM table WHERE salary=X AND location=Y AND job_type=Z

Are there any useful tutorials on this kind of thing, or is anyone out
there able to shed some light? I'll be working in a PHP5 environment.
Assuming you have XML like this
<table>
<row>
<salary>1234</salary>
<location>London</location>
<job_type>webmaster</job_type>
</row>
<row>
<salary>1000</salary>
<location>Oxford</location>
<job_type>junior webmaster</job_type>
</row>
<!-- further row elements here -->
</table>
then you can use an XPath expression alike
/table/row[salary >= 1000 and location = 'London' and job_type =
'webmaster']
to select all matching row elements.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 19 '07 #2
And if you need more power, the XSLT transformation language and/or the
XQuery language provide additional looping, sorting, and formatting
capabilities on top of XPath searches. (XSLT 2.0 and XQuery 1.0 are
actually pretty close to semantically equivalent -- their specs are
literally generated from the same source files to help keep them
consistent with each other -- but they're tuned for different kinds of
tasks.)

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 19 '07 #3
Thanks guys - didn't realise it was quite so straightforward!

Jun 19 '07 #4

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

Similar topics

4
by: Michael Whittaker | last post by:
Hello! I have a problem with my php script. The script's task is to search an IP-Database with ranges as entries and find, in which range the entered IP is. OK, I've queried the MySQL-Results...
1
by: Ravi Shankar | last post by:
Hi all, I have a calendar application( like Microsoft Outlook) writtn in Java.Whenever an event is created, we can set SMS/EMAIL notification. Hence when an event is created, I am storing that...
3
by: Keith | last post by:
I am fairly new to SQL so sorry if this is a really dumb question. I have a small (still) SQL database, which I am trying to query from an ASP page. The field I am querying is of DATETIME data...
1
by: valexena | last post by:
After a few minutes of querying the database my session disconnects abruptly. Can somebody help me and tell why can be happening? -- Posted via http://dbforums.com
1
by: Ron L. | last post by:
Hi, Any suggestions for a good intorudction to OLAP querying with MDX? Thanks, Ron. -- Performance Intelligence, Inc. Spy 4 DB2 - http://www.pireporting.com/spy4db2.html
6
by: Greg | last post by:
I am working on a project that will have about 500,000 records in an XML document. This document will need to be queried with XPath, and records will need to be updated. I was thinking about...
5
by: Shane | last post by:
I wonder if someone has any ideas about the following. I am currently producing some reports for a manufacturing company who work with metal. A finished part can contain multiple sub-parts to...
3
by: MDB | last post by:
I'd normally Google for a question like this, and hope to snag a few examples along with the answer, but this time I can't see to get the keywords specific enough. Or I'd ask coworkers, but...
2
by: RajSharma | last post by:
Hi, I am facing a problem regarding querying thru a large table having millions of rows....... Its hanging in between while querying for all those rows Can anybody suggest me a query regarding :...
4
by: =?Utf-8?B?U3VoYXMgVmVuZ2lsYXQ=?= | last post by:
Hello, I am facing an issue while querying Active directory using C# code with system.DirectoryServices namespace. Here is the path for my LDAP - "LDAP://CN=XY - C++/Unix and other,...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.