XMLNSC opaque parsing

Opaque parsing is a performance feature that is offered by the XMLNSC domain.

If you are designing a message flow and you know that certain elements in a message are never referenced by the message flow, you can specify that these elements are parsed opaquely. This reduces the costs of parsing and writing the message, and might improve performance in other parts of the message flow.

Use the property Opaque Elements on the Parser options page of the relevant message flow node to specify the elements that you want to be parsed opaquely. This property specifies a list of element names. If an element in the input XML message is named in this list, the element is parsed as a single string.

An opaque element cannot be queried like an ordinary element; its value is the segment of the XML bit stream that belongs to the element, and it has no child elements in the message tree, even though it can represent a large subtree in the XML document.

When an opaque element is serialized, the value of the element is copied directly into the output bit stream. The string is converted to the correct code page, but no other changes are made. Because this might produce a bit stream that is not valid XML, some care is required.

Do not parse an element opaquely in any of the following cases:

  • The message flow must access one of its child elements.
  • The message flow changes the namespace prefix in a way that affects the opaque element or one of its child elements and the element is to be copied to the output bit stream.
  • The element, or any child element, contains a reference to an internal entity that is defined in an inline DTD and the element is to be copied to the output bit stream.
  • The element contains child attributes that have default values that are defined in an inline DTD and the element is to be copied to the output bit stream.

Make sure that you check the above points before you specify an element for opaque parsing.

Using opaque parsing has some drawbacks. When opaque parsing is enabled, some parts of the message are never parsed, and XML that is either badly formed or not valid is allowed to pass through the message flow without being detected. For this reason, if you enable validation, you cannot use opaque parsing.

The XMLNS domain offers a more limited opaque parsing facility, but this is provided only to support existing applications. Use the XMLNSC domain in new message flows if you want to use opaque parsing.