IsValidString (XmlDoc function)

From m204wiki
Jump to navigation Jump to search

Valid XML Element/Attribute value?

IsValidString is a member of the XmlDoc class.

This shared function determines whether a string value is a valid XML Element or Attribute value. Designed to be used prior to updating an XmlDoc, this function was new as of version 6.8 of Sirius Mods and deprecated in favor of InvalidCharacterPosition in version 7.0.

Syntax

  %bool = %(XmlDoc):IsValidString(value)

Syntax Terms

%bool
A declared enumeration object of type Boolean to contain the returned value (True or False) of IsValidString. For more information about enumerations, see Enumerations.
%(XmlDoc)
The class name in parentheses denotes a shared method; you may instead provide an XmlDoc object expression (for example, a %variable). For more information about shared methods, see ?? refid=shared..
value
The input string whose characters are to be validated. As of Sirius Mods version 7.6, this may be a Unicode string or an EBCDIC string. Formerly, only EBCDIC was allowed.

Usage Notes

  • IsValidString returns True if its argument string is:
    • Unicode, and all characters are legal in an Element or Attribute value (that is, it does not contain any null characters).
    • EBCDIC, and all characters are translatable to Unicode characters other than the null character.

    Otherwise, it returns False.

    Prior to Sirius Mods 7.6, the invalid characters of an Element or Attribute node were the EBCDIC “control characters.”

  • If the result of the IsValidString call is True:
    • The AddAttribute, AddElement, AddText, InsertTextBefore, and InsertElementBefore functions may use the value string as their second argument.
    • The Value property of an Element, Attribute, or Text node may use the value string as the right side of an assignment (subject to restrictions on null strings).

Request-Cancellation Errors

  • IsValidString has no request cancellation errors.