XmlUtils.XmlString

Turns a string into a properly XML Encoded string. Uses simple string replacement.

Also see XmlUtils.XmlString() which uses XElement to handle additional extended characters.

public static string XmlString(string text,
	bool isAttribute)

Return Value

XML encoded string

Parameters

text
Plain text to convert to XML Encoded string

isAttribute
If true encodes single and double quotes. When embedding element values quotes don't need to be encoded. When embedding attributes quotes need to be encoded.

Exceptions

**System.InvalidOperationException**
Invalid character in XML string

See also:

Class XmlUtils

© West Wind Technologies, 2019 • Updated: 06/23/19
Comment or report problem with topic