InvalidCharacterPosition (XmlDoc function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (edits, tags and links)
m (fix "using boolean enumerations" link)
Line 13: Line 13:
<td>The input string whose characters are to be validated. As of <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> Version 7.6, this may be a <var>Unicode</var> string or an EBCDIC string. Formerly, only EBCDIC was allowed. </td></tr>
<td>The input string whose characters are to be validated. As of <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> Version 7.6, this may be a <var>Unicode</var> string or an EBCDIC string. Formerly, only EBCDIC was allowed. </td></tr>
<tr><th><var>AllowNull</var></th>
<tr><th><var>AllowNull</var></th>
<td>This optional, but <var>[[Methods#Named parameters|Name-Required]]</var>, is a <var>[[Boolean Enumeration]]</var> which determines whether an input null character is considered invalid.
<td>This optional, but <var>[[Methods#Named parameters|Name-Required]]</var>, is a [[Enumerations#Using_Boolean_enumerations|"Boolean Enumeration"]] which determines whether an input null character is considered invalid.
<p>The default value of <var class="term">AllowNull</var> is <code>False</code>, which causes an input null character to be treated as invalid. If  <var class="term">AllowNull</var> is <code>True</code>, an input null is valid.</p>
<p>The default value of <var class="term">AllowNull</var> is <code>False</code>, which causes an input null character to be treated as invalid. If  <var class="term">AllowNull</var> is <code>True</code>, an input null is valid.</p>
<p> <var class="term">AllowNull</var> is available as of <var class="product">"Sirius Mods"</var> Version 7.6.</p></td></tr>
<p> <var class="term">AllowNull</var> is available as of <var class="product">"Sirius Mods"</var> Version 7.6.</p></td></tr>

Revision as of 09:30, 19 May 2011

Detect invalid characters (XmlDoc class)

InvalidCharacterPosition validates whether the characters in a string may be used as the value of an Element or Attribute node. The method checks the characters in its value argument and returns 0 if they are all valid; otherwise, it returns the position of the first invalid character.

Syntax

%position = %(XmlDoc):InvalidCharacterPosition( string, [AllowNull= boolean])

Syntax terms

%position The numeric position of the first character that is not valid to be used as the value of an Element or Attribute node; otherwise, 0 if all characters are valid.
%(XmlDoc) The class name in parentheses denotes a shared method. InvalidCharacterPosition can also be invoked via an XmlDoc object variable, which may be null.
string 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.
AllowNull This optional, but Name-Required, is a "Boolean Enumeration" which determines whether an input null character is considered invalid.

The default value of AllowNull is False, which causes an input null character to be treated as invalid. If AllowNull is True, an input null is valid.

AllowNull is available as of "Sirius Mods" Version 7.6.

Usage notes

  • InvalidCharacterPosition returns zero if its argument string is:
    • Unicode, and all characters are legal in an XML document (the only illegal character is the null character, if AllowNull=False).
    • EBCDIC, and all characters are translatable to Unicode characters (and, if AllowNull=False, there are no null characters).

    Otherwise, it returns the character position of the first character that does not meet these criteria.

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

  • With the introduction of this method, the IsValidString function is deprecated.
  • This method was actually introduced in "Janus Soap" Version 6.9, but its documentation first appeared in Version 7.0.

See also