Namespaces in XML Detection

Detection is the process of matching or identifying input documents with the proper Partner Agreements. This process is done in two ways: XML and Flat. For discussion, namespace changes focus on XML detection.

In earlier IEC versions, detection is done without using namespaces, even if your XML document has, or is using namespace. Detection is handled by a namespace ignorant XML Path. This figure shows the Detection tab in IEC v9.0.1.0:

Without using namespace:

The <Envelope> on the second line is a simple example with no namespace.
<?xml version="1.0"?>
		<Enveloe>
			<Header>
				<delivery>
					<from>
						<address> this is detected!</address>
					<from>

Using a namespace:

The namespace "env" on the third line is defined by URI http://www.intentia.com/MBM Envelope.

<?xml version="1.0"?>
<Envelope xmlns="http://www.intentia.com/MBM"
xmlns:env="http://www.intentia.com/MBM_Envelope"
xmlns:xsi="http://www.w3.org/2001/SMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://www.intentia.com/MBM MBM_Test_20_in.xsd">
		<Header>
			<env:delivery>
				<env:from>
					<env:address> this is detected!</address>
				</env:from>

Using another namespace:

The namespace "env" on the third line is defined by URI http://www.intentia.com/MBM Another Envelope.

<?xml version="1.0"?>
<Envelope xmlns="http://www.intentia.com/MBM"
xmlns:env="http://www.intentia.com/MBM_Another_Envelope"
xmlns:xsi="http://www.w3.org/2001/SMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://www.intentia.com/MBM MBM_Test_20_in.xsd">
		<Header>
			<env:delivery>
				<env:from>
					<env:address>this is detected!</address>
				</env:from>

New fields in the Detections tab

This table shows the fields in the Detections tab that support the use of namespaces:
Field Description
Actual Xpath This field is automatically generated and shows the internal representation of IEC for the XPath.
Default Namespace URI This field represents the default namespace. A default namespace is applied to all elements without prefix.
Namespace Prefix and Namespace URI Other namespaces are defined here. You must specify this information for every target XML detection item.

Example

Using the namespace, look at how this setting affects our previous scenarios. Here are the XML target settings that we can use:
  • Name: env:from
  • Default Namespace URI: http://www.intentia.com/MBM
  • Other Namespaces:

    Namespace Prefix: env

    Namespace URI: http://www.intentia.com/MBM_Envelope

A. Without namespace:

On the third line, the <Envelope> is a simple example with no namespace.

<?xml version="1.0"?>
<Envelope>
		<Header>
			<delivery>
				<from>
					<address>this is NOT detected!</address>
				</from>

B. Using namespace:

On the third line, namespace env is defined by the URI http:// www.intentia.com/MBM Envelope.

<?xml version="1.0"?>
<Envelope xmlns="http://www.intentia.com/MBM"
xmlns:env="http://www.intentia.com/MBM_Envelope"
xmlns:xsl="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://www.intentia.com/MBM MBM_Test_20_in.xsd">
			<Header>
				<env:delivery>
					<env:from>
						<env:address>this is STILL detected!</address>
					</env:from>
Note: The prefix env does not have to match the prefix used in the detections tab. It can be a different element and it is still identifiable.

C. Using another namespace:

On the third line, namespace env is defined by the URI http:// www.intentia.com/MBM Another Envelope.

The elements are not in a different namespace and do not match.
<?xml version="1.0"?>
<Envelope xmlns="http://www.intentia.com/MBM"
xmlns:env="http://www.intentia.com/MBM_Another_Envelope"
xmlns:xsi="http://www.w3.org/2001/SMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://www.intentia.com/MBM MBM_Test_20_in.xsd">
		<Header>
			<env:delivery>
				<env:from>
					<env:address>this is NOT detected!</address>
				</env:from>

D. Using a default namespace:

This is another trivial scenario that matches our defined settings.

On the second line, elements Envelope and Header still match the URI from the settings in Detection. Elements delivery, from, and address, although now in the default namespace, still match the URI from the settings in Detection.
<?xml version="1.0"?>
<Envelope xmlns="http://www.intentia.com/MBM"
xmlns:env="http://www.intentia.com/MBM"
xmlns:xsi="http://www.w3.org/2001/SMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://www.intentia.com/MBM MBM_Test_20_in.xsd">
		<abc:Header>
			<delivery>
				<from>
					<address>this is STILL detected!</address>
				</from>

E. Using a different prefix:

On the third line, the namespace abc is defined by URI http:/ www.intentia.com/MBM Envelope, which is similar to the URI in Detection.

<?xml version="1.0"?>
<abc:Envelope xmlns="http://www.intentia.com/MBM"
xmlns:abc="http://www.intentia.com/MBM"
xmlns:xsi="http://www.w3.org/2001/SMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://www.intentia.com/MBM MBM_Test_20_in.xsd">
		<Header>
			<abc:delivery>
				<abc:from>
					<abc:address>this is STILL detected!</address>
				</abc:from>