cancel
Showing results for 
Search instead for 
Did you mean: 

Condition editor - XPATH expression with string-length

0 Kudos

Hello experts,

I have follow XPath expression in the condition editor:

/p1:empfaengerInput/vsnr[string-length(@ID)>2] EX 

I want to do something, if the length of the attribute ID is greater than 2. But it doesn't work.

Is the XPATH expression correct?

Thx for your help!

Jürgen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jürgen,

as XI 3.0 can only process XPATH 1.0 you have to use:

/p1:empfaengerInput/vsnr/@ID[string-length()>2]

Regards Mario

Edited by: Mario Müller on May 2, 2008 9:07 AM

0 Kudos

Hello Mario,

you are right! Now it works fine!

Thanks a lot!

Bye

Jürgen

Answers (6)

Answers (6)

stefan_grube
Active Contributor
0 Kudos

>

/p1:empfaengerInput/vsnr[string-length(@ID)>2] EX 

The same XPATH worked for me. So there might be any other issue. Maybe a cache problem?

Is in your trace an entry like this:

<Trace level="2" type="T">Classic Receiver Determination via Rules.</Trace> 
  <Trace level="3" type="T">...create rule engine</Trace> 
  <Trace level="2" type="T">Check conditions for rule line no. 1</Trace> 
  <Trace level="3" type="T">...call rule engine for Condition %CL_SAI_SWF_RULE_ENGINE.MSG_GET(MSG=&_MSG&;NSP=&_NSM&;XPATH="/p1:empfaengerInput/vsnr[string-length(@ID)>2]")% EX</Trace> 
  <Trace level="2" type="T">......extracting (old) for Extractor: XP /p1:empfaengerInput/vsnr[string-length(@ID)>2]</Trace> 
  <Trace level="2" type="T">......extracting values found: 1</Trace> 
  <Trace level="2" type="T">......extracting values found: 1</Trace> 
  <Trace level="2" type="T">...valid Receiver with Condition: - MyReceiver</Trace> 
  <Trace level="2" type="T">No Receiver found behaviour: 0</Trace> 
  <Trace level="2" type="T">Number of Receivers:1</Trace>

0 Kudos

Hello Stefan,

I can't find the entry:

Here you can find my trace:


<Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PLSRV_LOCAL">
- <Trace level="1" type="B" name="CL_RD_PLSRV-ENTER_PLSRV">
  <Trace level="1" type="T">R E C E I V E R - D E T E R M I N A T I O N</Trace> 
  <Trace level="1" type="T">Cache Content is up to date</Trace> 
  <Trace level="2" type="T">Start without given receiver</Trace> 
  <Trace level="2" type="T">Classic Receiver Determination via Rules.</Trace> 
  <Trace level="2" type="T">Check conditions for rule line no. 1</Trace> 
  <Trace level="2" type="T">...valid Receiver w/o Condition: - E_VERMITTLERSERVICE_QAS</Trace> 
  <Trace level="2" type="T">No Receiver found behaviour: 0</Trace> 
  <Trace level="2" type="T">Number of Receivers:1</Trace> 
  </Trace>
  </Trace>
  </Trace>

We have restart the engine (ABAP+Java).( Cache Problem?, but without success)

If the length of the string is greater than 2, I think it works.

But if the length of the string is lower than 2, I can see an error (Timeout, I can't see the Workflow of the integrationprocess in the Message Monitoring)

Best regards,

Jürgen

0 Kudos

Hello,

thanks to all for your help!

I tried all your suggestions but without success.

Here you can find the xml:


<?xml version="1.0" encoding="UTF-8" ?> 
<ns:empfaengerInput xmlns:ns="urn:test.modus">
<vsnr ID="Q534343434356343345">25</vsnr> 
</ns:empfaengerInput>



(empfaengerInput./p1:empfaengerInput/vsnr[string-length(@ID)>2] EX )

p1 -->  urn:test.modus 

My goal is to check if the ID in vnsr has a value or not.

I thought the best solution for this requirement is to use XPATH.

Bye

Jürgen

henrique_pinto
Active Contributor
0 Kudos

Try

/p1:empfaengerInput/vsnr/@ID[string-length(.)>2] EX

And as said, make sure the namespaces are correctly defined (some attributes also have namespace).

Regards,

Henrique.

stefan_grube
Active Contributor
0 Kudos

When I remember right, than you have to use ./@ID for an attribute, when you want to refer to a relative path.

Make also sure, that the namespace declaration in the condition editor is set correctly.

Maybe you post the relevant part of your XML to look for further hints.

Regards

Stefan

Former Member
0 Kudos

Give the following expression in the square brackets and try

string-length(@ID) > 2

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

hi,

take a look to these links

The string seams to be right except by the @.Delete it and try again.

If you have a xml editor like Altova(XML SPY) you can check whether the Xpath works.

http://www.w3schools.com/xpath/xpath_functions.asp

http://www.w3schools.com/xpath/xpath_operators.asp

Thanks

Rodrigo

Edited by: Rodrigo Pertierra on Apr 29, 2008 10:22 AM

0 Kudos

Hi,

thanks for your help.

I have deleted the @, but it doesn't work.

I think I have to use the @, because it is an attribute.

best regards,

Jürgen

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

hi

separate the ">" from (@ID)

Check the XPath in XML Spy (Altova) if you have it

Thanks

Rodrigo