InvalidCharacterPosition (XmlDoc function): Difference between revisions
m (fix "using boolean enumerations" link) |
m (→Usage notes) |
||
(20 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:XmlDoc:InvalidCharacterPosition subtitle}} | {{Template:XmlDoc:InvalidCharacterPosition subtitle}} | ||
<var>InvalidCharacterPosition</var> validates whether the characters in a string may be used as the value of an <var>Element</var> or <var>Attribute</var> node. The method checks the characters in its <var class="term"> | <var>InvalidCharacterPosition</var> validates whether the characters in a string may be used as the value of an <var>Element</var> or <var>Attribute</var> node. The method checks the characters in its <var class="term">string</var> argument and returns 0 if they are all valid; otherwise, it returns the position of the first invalid character. | ||
==Syntax== | ==Syntax== | ||
Line 8: | Line 8: | ||
<tr><th>%position</th> | <tr><th>%position</th> | ||
<td>The numeric position of the first character that is '''not''' valid to be used as the value of an <var>Element</var> or <var>Attribute</var> node; otherwise, 0 if all characters are valid. </td></tr> | <td>The numeric position of the first character that is '''not''' valid to be used as the value of an <var>Element</var> or <var>Attribute</var> node; otherwise, 0 if all characters are valid. </td></tr> | ||
<tr><th>%(XmlDoc)</th> | <tr><th><var class="nobr">%(XmlDoc)</var></th> | ||
<td>The class name in parentheses denotes a shared method. <var>InvalidCharacterPosition</var> can also be invoked via an <var>XmlDoc</var> object variable, which may be null.</td></tr> | <td>The class name in parentheses denotes a [[Notation conventions for methods#Shared methods|shared]] method. <var>InvalidCharacterPosition</var> can also be invoked via an <var>XmlDoc</var> object variable, which may be null.</td></tr> | ||
<tr><th>string</th> | <tr><th>string</th> | ||
<td>The input string whose characters are to be validated. As of <var class="product">[[Sirius Mods | <td>The input string whose characters are to be validated. As of <var class="product">[[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, | <td>This optional, [[Methods#Named parameters|name required]], argument is a [[Enumerations#Using_Boolean_enumerations|Boolean enumeration]] that determines whether an input null character is considered invalid. | ||
<p>The default value of <var | <p>The default value of <var>AllowNull</var> is <var>False</var>, which causes an input null character to be treated as invalid. If <var>AllowNull</var> is <var>True</var>, an input null is valid.</p> | ||
<p> <var | <p> <var>AllowNull</var> is available as of <var class="product">Sirius Mods</var> Version 7.6.</p></td></tr> | ||
</table> | </table> | ||
Line 23: | Line 23: | ||
<ul> | <ul> | ||
<li><var>Unicode</var>, and all characters are legal in an XML document (the only illegal character is the null character, if <code>AllowNull=False</code>). | <li><var>Unicode</var>, and all characters are legal in an XML document (the only illegal character is the null character, if <code>AllowNull=False</code>). | ||
<li>EBCDIC, and all characters are translatable to <var>Unicode</var> characters (and, if <code>AllowNull=False</code>, there are no null characters). | <li>EBCDIC, and all characters are translatable to <var>Unicode</var> characters (and, if <code>AllowNull=False</code>, there are no null characters). | ||
</ul> | </ul> | ||
Otherwise, it returns the character position of the first character that does not meet these criteria. | Otherwise, it returns the character position of the first character that does not meet these criteria. | ||
<p>Prior to <var class="product"> | <p>Prior to <var class="product">Sirius Mods</var> Version 7.6, the invalid characters of an <var>Element</var> or <var>Attribute</var> node were the EBCDIC "control characters."</p> | ||
<li>With the introduction of this method, the <var> | |||
<li>With the introduction of this method, the <var>IsValidString</var> function is deprecated. | |||
</ul> | </ul> | ||
==See also== | ==See also== | ||
{{Template:XmlDoc:InvalidCharacterPosition footer}} | {{Template:XmlDoc:InvalidCharacterPosition footer}} |
Latest revision as of 20:39, 3 March 2014
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 string 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, name required, argument is a Boolean enumeration that 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."
- Unicode, and all characters are legal in an XML document (the only illegal character is the null character, if
- With the introduction of this method, the IsValidString function is deprecated.