XmlDoc.EncodeEntities Shared Method

Returns a String generated by encoding any special characters in an input String expression, which permits their use in XML entity values.

XmlDoc.EncodeEntities(input_string)

Prerequisites

None

Parameters

input_string

A required String expression that contains the characters to be encoded.

Remarks

Names and data within an XML text document must not contain the special characters shown in the table below. So, these special characters must be encoded if they are to be included in an XML entry. For efficiency the XML methods in GPL do not automatically check for these characters since their use is not very common.

If you need to include these characters, this method can be used to encode the special characters before they are inserted into a GPL DOM document tree. To decode data after it has been extracted from a GPL DOM tree, see the method XmlDoc.DecodeEntities.

This method converts the input_string value, automatically encoding any special UTF-8 characters that it encounters into equivalent values according to Table 19-119, and returns the result as a String value. This method does not convert UTF-8 to 8-bit ASCII (e.g. ISO-8859-1).

Table 19-119: input_string Value

Character Hex value Name Encoding

"

&H22

double quote

"

&

&H26

ampersand

&

'

&H27

apostrophe

'

<

&H3C

less than

&lt;

>

&H3E

greater than

&gt;

Examples

Dim root As XmlNode
Dim ss As String
. . .
ss = XmlDoc.EncodeEntities(ss)
ss = root.SetElement("section1", ss)

See Also

XML Classes |XmlDoc.DecodeEntities