KB Article #177556
Empty XML elements passing through API gateway
Problem
XML permits an element with no content to be represented in two ways. First it can appear with one angle bracket pair and a slash before the close angle bracket. Alternatively it can be written as a start tag and an end tag with nothing in between. In canonicalized XML empty element tags are replaced by start tag, end tag pairs.
The API Gateway can be found to convert a canonicalized format message on the wire possibly in the connection filter into non-canonicalized format.
e.g. message came into the API Gateway with element
<Example></Example>
and is send out to a receiver as
<Example/>
These formats are semantically identical but it may cause issue for the receiver of the message.
Resolution
The following LibXml2 options are available in 7.4.0 SP1 and after via libxml.xml:
apigateway/system/conf/libxml.xml
<!-- Save Options -->
<LibxmlFeature name="XML_SAVE_FORMAT" value="0"/>
<LibxmlFeature name="XML_SAVE_NO_DECL" value="0"/>
<LibxmlFeature name="XML_SAVE_NO_EMPTY" value="0"/>
<LibxmlFeature name="XML_SAVE_NO_XHTML" value="0"/>
<LibxmlFeature name="XML_SAVE_XHTML" value="0"/>
<LibxmlFeature name="XML_SAVE_AS_XML" value="0"/>
<LibxmlFeature name="XML_SAVE_AS_HTML" value="0"/>
<LibxmlFeature name="XML_SAVE_WSNONSIG" value="0"/>
<LibxmlFeature name="XML_SAVE_NO_REDUNDANT_NS_DEFS" value="0"/>
The XML_SAVE_NO_EMPTY should be turned on in order to generate <a></a> node instead of <a/>.