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