473,326 Members | 2,013 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,326 software developers and data experts.

contains

Hello,

I'm an XML newbie, trying things through perl. My question must be
simple and is related to XPath.

I've got
<?xml version="1.0" encoding="iso-8859-1"?>
<base>
<arret ref="10400390" public="yes" ville="Paris">
<objet>Droits d'auteur, oeuvre cinématographique, contrat de
cession</objet>
</arret>
<arret ref="37484740" public="yes" ville="Paris">
<objet>Droit des marques, commercialisation de denrées sous une
marque, faute contractuelle, accord de coexistence de marques,
contrefaçon, concurrence déloyale</objet>
</arret>
<arret ref="38748168" public="no" ville="Paris">
<objet>Rupture abusive de contrat de distribution</objet>
</arret>
</base>

I want an XPath to catch the <arret> when objet contains the word
"marques".

I've tried /base/arret/objet[contains(text(),marques)=true] but i'm
too much an XML dummy for this to work.

Can anyone help me ?

--
|":._.:"| http://habett.com/
| (=) | http://habett.org/
..\./|\./. My employer has my views
Jul 20 '05 #1
3 1185
In <dc***************@habett.habett.org>, Stephane Roux (HAbeTT)
wrote:
I want an XPath to catch the <arret> when objet contains the word
"marques".

I've tried /base/arret/objet[contains(text(),marques)=true] but i'm
too much an XML dummy for this to work.


OK, I found it by myself,
/base/arret/objet[contains(text(),'marques')]/parent::*

Right ?
--
|":._.:"| http://habett.com/
| (=) | http://habett.org/
| .:':. | I send the energy to my enemy
Jul 20 '05 #2

/base/arret/objet[contains(text(),'marques')]/parent::*

that works but rather than going down and back up again it's probably
more natural to write an Xpath that more closely models your natural
language description
I want an XPath to catch the <arret> when objet contains the word
"marques".


/base/arret/[contains(objet,'marques')]

So long as each arret only has one arret child, as this form only checks
the first.

David
Jul 20 '05 #3
Stephane Roux (HAbeTT) wrote:
In <dc***************@habett.habett.org>, Stephane Roux (HAbeTT)
wrote:

I want an XPath to catch the <arret> when objet contains the word
"marques".

I've tried /base/arret/objet[contains(text(),marques)=true] but i'm
too much an XML dummy for this to work.

OK, I found it by myself,
/base/arret/objet[contains(text(),'marques')]/parent::*

Right ?


hi,

try this :
/base/arret[contains(objet/text(),'marques')]

--
Cordialement,

///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------
Jul 20 '05 #4

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

Similar topics

2
by: Piotr Szukalski | last post by:
Hi! I have trouble with 'Contains' method in ListViewItemCollection class - it seems like it nevers calls 'Equals' method of class inherited from ListViewItem... I've found that ListViewItem...
3
by: andrew.miadowicz | last post by:
It's funny that I've only now run into this question, after a few years of using C#, but I find it intriguiging all the same. All the more so, that the generic version of ICollection in .Net...
2
by: Dot net work | last post by:
Hello, My simple code is here: Public Class MyDictionary Inherits System.Collections.DictionaryBase Private Class MyElement Public Overloads Overrides Function Equals(ByVal obj As Object)...
1
by: djamilabouzid | last post by:
Hi, I have a question about MS SQL Server 2005: I have a table in the database that contains 70 fields. I must perform full-text search in about 60 fields. I use for that the full-text...
3
by: Christopher H | last post by:
I've been reading about how C# passes ArrayLists as reference and Structs as value, but I still can't get my program to work like I want it to. Simple example: ...
2
by: Jeff | last post by:
..NET 2.0 I'm trying to use List.Contains to determine if an object already exist in the list. This Contains method always return false in my code In my code a method gets a list of names, the...
4
by: BeSharp | last post by:
I recently stumbled across a pretty interesting LINQ to SQL question and wonder, whether anybody might have an answer. (I'm doing quite some increasing LINQ evangelism down here in Germany.). ...
8
by: Tanzen | last post by:
I'm working in visual studio 2005 trying to learn visual basic. Having come from an VB for Access background, I'm finding it a big learning curve. I have been working through several e-books which...
8
by: SMJT | last post by:
Does anyone know why the string contains function always returns true if the token is an empty string? I expected it to return false. "AnyOldText".Contains("") or...
4
by: seberino | last post by:
I'm looking over the docs for the re module and can't find how to "NOT" an entire regex. For example..... How make regex that means "contains regex#1 but NOT regex#2" ? Chris
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
1
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: 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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.