472,143 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Expression must evaluate to a node-set

I am using xpath within a BizTalk 2006 orchestration.
I get the following error "Expression must evaluate to a node-set".

My xml:

<EmailListResponse xmlns="http://BTTest">
<PersonContact EMailContactValue="te***@mail.com" />
<PersonContact EMailContactValue="te***@mail.com" />
</EmailListResponse>
My xpath expression which generates the error message:

varNoOfEmailAddresses = (System.Int32)xpath(msgEmailListRes, "count(/
*[local-name()='EmailListResponse']/*[local-name()='PersonContact']/
*[[local-name()='EMailContactValue']
[not(text()=preceding::EMailContactValue/text())])");

varNoOfEmailAddresses is a local orchestration variable
msgEmailListRes is a local orchestration message
Kan anyone tell me what I am doing wrong?
I have the following xml and xpath expression, which does not fail
(very similar):

<SHT_Req xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://
BTTest.Schemas.SHT_Req">
- <Header xmlns="">
<SHTRefId>20070130_12</SHTRefId>
<SentAt>2007-01-30T00:00:00</SentAt>
</Header>
- <Body xmlns="">
- <VesselIdentification>
<IMONumber>3424</IMONumber>
<MMSINumber>23424</MMSINumber>
<CallSign>234</CallSign>
<ShipName>20070130_12</ShipName>
</VesselIdentification>
- <AISInformation>
<Longitude>3234</Longitude>
<Latitude>234234</Latitude>
<Timestamp>2007-01-30T00:00:00</Timestamp>
<Destination>234</Destination>
</AISInformation>
- <NotifyCountries>
<CountryCode>NOR</CountryCode>
</NotifyCountries>
</Body>
</SHT_Req>

varNoOfCountries = (System.Int32)xpath(msgSHT_Req, "count(/*[local-
name()='SHT_Req']/*[local-name()='Body']/*[local-
name()='NotifyCountries']/*[local-name()='CountryCode']
[not(text()=preceding::CountryCode/text())])");

varNoOfCountries is a local orchestration variable
msgSHT_Req is a local orchestration message

Jan 30 '07 #1
2 14668
an*************@hotmail.com wrote:
I am using xpath within a BizTalk 2006 orchestration.
I get the following error "Expression must evaluate to a node-set".

My xml:

<EmailListResponse xmlns="http://BTTest">
<PersonContact EMailContactValue="te***@mail.com" />
<PersonContact EMailContactValue="te***@mail.com" />
</EmailListResponse>
My xpath expression which generates the error message:

varNoOfEmailAddresses = (System.Int32)xpath(msgEmailListRes, "count(/
*[local-name()='EmailListResponse']/*[local-name()='PersonContact']/
*[[local-name()='EMailContactValue']
[not(text()=preceding::EMailContactValue/text())])");
You are at least not properly dealing with the EMailContactValue
attributes in the XML as your XPath only looks at elements. I am not
sure what you want to achieve, does this XPath help?

count(/*[local-name()='EmailListResponse']/*[local-name()='PersonContact']
[not(@EMailContactValue=preceding::*/@EMailContactValue)])

It counts the elements with local name being 'PersonContact' for which
the attribute condition
not(@EMailContactValue=preceding::*/@EMailContactValue) holds.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jan 30 '07 #2
I am using xpath within a BizTalk 2006 orchestration.
I get the following error "Expression must evaluate to a node-set".

My xml:

<EmailListResponse xmlns="http://BTTest">
<PersonContact EMailContactValue="te***@mail.com" />
<PersonContact EMailContactValue="te***@mail.com" />
</EmailListResponse>
My xpath expression which generates the error message:

varNoOfEmailAddresses = (System.Int32)xpath(msgEmailListRes, "count(/
*[local-name()='EmailListResponse']/*[local-name()='PersonContact']/
*[[local-name()='EMailContactValue']
[not(text()=preceding::EMailContactValue/text())])");

varNoOfEmailAddresses is a local orchestration variable
msgEmailListRes is a local orchestration message
Kan anyone tell me what I am doing wrong?
I have the following xml and xpath expression, which does not fail
(very similar):

<SHT_Req xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://
BTTest.Schemas.SHT_Req">
- <Header xmlns="">
<SHTRefId>20070130_12</SHTRefId>
<SentAt>2007-01-30T00:00:00</SentAt>
</Header>
- <Body xmlns="">
- <VesselIdentification>
<IMONumber>3424</IMONumber>
<MMSINumber>23424</MMSINumber>
<CallSign>234</CallSign>
<ShipName>20070130_12</ShipName>
</VesselIdentification>
- <AISInformation>
<Longitude>3234</Longitude>
<Latitude>234234</Latitude>
<Timestamp>2007-01-30T00:00:00</Timestamp>
<Destination>234</Destination>
</AISInformation>
- <NotifyCountries>
<CountryCode>NOR</CountryCode>
</NotifyCountries>
</Body>
</SHT_Req>

varNoOfCountries = (System.Int32)xpath(msgSHT_Req, "count(/*[local-
name()='SHT_Req']/*[local-name()='Body']/*[local-
name()='NotifyCountries']/*[local-name()='CountryCode']
[not(text()=preceding::CountryCode/text())])");

varNoOfCountries is a local orchestration variable
msgSHT_Req is a local orchestration message
what is the cost of your csc steel and other csc programes

BizTalk Utilities - Frustration free BizTalk Adapters
http://www.topxml.com/biztalkutilities
Mar 2 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Christoph Putz | last post: by
3 posts views Thread by Coco | last post: by
5 posts views Thread by Csaba Gabor | last post: by
3 posts views Thread by Jeff | last post: by
4 posts views Thread by =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post: by
11 posts views Thread by =?ISO-8859-1?Q?Une_B=E9v?==?ISO-8859-1?Q?ue?= | last post: by
reply views Thread by leo001 | last post: by

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.