Encapsulating ESD may be done in the following ways:
However, this raises some problems, as ESD code may contain XML specific data, such as characters like ``<''. This problem may be circumvented by converting these characters to XML entities93. Such XML code is called ``Encoded XML''. Another way would be to use a specific XML element, called ``<[!CDATA[...]]>''94. A sample SOAP message that embeds ESD code is shown in listing 30.
This method is easy to implement and already available tools and functions that are based on the ESD syntax may be reused completely this way. Moreover, the good communication abilities of SOAP/HTTP may be used95.
However, these advantages come at a high price: The gateway has to implement an XML parser with considerable hardware requirements. Moreover, the XML parser cannot be used to validate fieldbus data due to the structure of the ESD message format. Therefore the real advantage of XML documents - conveying metadata for validation and processing purposes - is left out.
Moreover, the ESD code depends a lot on whitespace96. Although the XML parser will not alter the whitespace97 and passes it to the applications ``as is'', possible reformatting of the SOAP message by client applications or debug tools could alter whitespace and make the ESD code erroneous. Structuring data with elements is more natural in XML documents and should be preferred over delimiting with whitespace.
Line 1 depicts the untranslated ESD code. Line 3 to 6 shows a possible translation, where the ESD code is split and embedded in several XML elements. The example in Line 8 to 15 also splits the datapoint address into several elements.
One advantage of this translation is easy data access through the XML parser. No whitespace parsing has to be done, fieldbus data can easily be accessed by addressing XML elements. Another advantage is human readability, which is improved compared to the conventional ESD code.
Translating ESD into XML code may be done in different ways. However, there are various available standards, as shown in chapter 3. If this ``translation process'' is done in a standard compliant way, the interoperability between the Internet/fieldbus gateway and according clients will be vastly improved.