all groups > dotnet xml > january 2007 >
You're in the

dotnet xml

group:

Expression must evaluate to a node-set


Expression must evaluate to a node-set anetasalomonsen NO[at]SPAM hotmail.com
1/30/2007 5:18:37 AM
dotnet xml:
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="test1@mail.com" />
<PersonContact EMailContactValue="test2@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
Re: Expression must evaluate to a node-set Martin Honnen
1/30/2007 2:38:48 PM
[quoted text, click to view]

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
RE: Expression must evaluate to a node-set dave
3/2/2007 10:39:58 PM

[quoted text, click to view]

what is the cost of your csc steel and other csc programes

BizTalk Utilities - Frustration free BizTalk Adapters
AddThis Social Bookmark Button