Expression must evaluate to a node-set - XML SOAP
This is a discussion on Expression must evaluate to a node-set - XML SOAP ; 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 ...
-
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="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
anetasalomonsen@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="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())])");
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/
-
RE: 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="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
what is the cost of your csc steel and other csc programes
BizTalk Utilities - Frustration free BizTalk Adapters
http://www.topxml.com/biztalkutilities
Similar Threads
-
By Application Development in forum Java
Replies: 1
Last Post: 12-13-2007, 12:38 PM
-
By Application Development in forum C
Replies: 6
Last Post: 11-20-2007, 05:12 PM
-
By Application Development in forum PROLOG
Replies: 2
Last Post: 11-10-2006, 12:33 AM
-
By Application Development in forum Javascript
Replies: 12
Last Post: 02-09-2005, 10:25 AM