Try OpenEdge Now
skip to main content
BPM Events User's Guide
XML messages : Namespace declaration
 

Namespace declaration

There are two types of namespace declarations. One is for declaring the prefix and URI pair whereas the other is for defining the default namespace.
For example,
namespace po="http://example.com/po";
namespace default="http://example.com/po";
The prefix is used as a name for the URI in BPM Events. Therefore, even if the prefix is different, if the associated URI value is the same, then they are semantically equivalent. The namespace is used for creating a namespace context in which the XPath is evaluated. When an XPath expression is evaluated, these namespace contexts are implicitly passed to the XPath engine. The scope of a namespace follows the normal block semantics. For instance, in the following code, inner po1 in separate block represents different namespace, and the context of namespace in each XPath expression consists of two namespaces.
{
  namespace po="http://example.com/po";
  {
    namespace po1="http://example.com/po1a";
      xml ~~ "po1:purcharseOrder[@a > 10]";
}  {
      namespace po1="http://example.com/po1b";
      xml ~~ "po1:purcharseOrder[@a > 10]";
}}
Note: When dot or array [] notation is used while declaring variables in DOM rules, you must define the default namespace to verify while rule compilation to avoid run-time error on that variable.