BRE – Element Exists XML Document

Posted: June 4, 2017  |  Categories: BizTalk

I have a BizTalk Business Engine (BRE) policy that gets a optional node from XML document as shown below.

In particular the excluded parcel type regex element is optional.

This works fine when the XML document contains the node. Unfortunately it fails with “Field does not exist in XML document” when the field does not exist. This blog shows how to fix this error.

Charles Young and StackOverflow outlines how to solve this error but I have written about his here because I found the solution hard to follow.

The solution to BRE error

John-305 says

One way I’ve found to address this is by creating a Vocabulary item and adjusting the Selector to point to the Element that may not exist..

.

Firstly the vocabulary selector shown above is  changed from

/*[local-name()=’SubscriptionRulesResult’ and namespace-uri()=’http://ShippingAPI.Notifications.Schemas.SubscriptionRulesResult’]

to

/*[local-name()=’SubscriptionRulesResult’ and namespace-uri()=’http://ShippingAPI.Notifications.Schemas.SubscriptionRulesResult’]/*[local-name()=’excluded_parcel_types’ and namespace-uri()=”]

Secondly, after setting the XPath field to the text() node the Selector path returns null because the BRE knows the fact doesn’t exist. Furthermore the error no longer occurs because the rule is not evaluated.

In conclusion editing the vocabulary selector and XPath field fixes the BRE error “Field does not exist in XML document”.

BizTalk360
BizTalk Server

Over 500+ customers across
30+ countries depend on BizTalk360

Learn More
Serverless360
Azure

Manage and monitor serverless
components effortlessly

Learn More
Atomicscope
Business Users

Monitor your Business Activity in iPaaS
or Hybrid integration solutions

Learn More

Back to Top