InvalidCharacterPosition (XmlDoc function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 12: Line 12:
<tr><th><i><b>%pos</b></i></th>
<tr><th><i><b>%pos</b></i></th>
<td>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. </td></tr>
<td>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. </td></tr>
<tr><th>%(XmlDoc)</th>
<tr><th>%(<var>XmlDoc</var>)</th>
<td>The class name in parentheses denotes a shared method and is one way to invoke the method. See the "Usage Notes," below for more about invoking this method. </td></tr>
<td>The class name in parentheses denotes a shared method and is one way to invoke the method. See the "Usage Notes," below for more about invoking this method. </td></tr>
<tr><th><i><b>value</b></i></th>
<tr><th><i><b>value</b></i></th>
<td>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. </td></tr>
<td>The input string whose characters are to be validated. As of ''Sirius Mods'' version 7.6, this may be a <var>Unicode</var> string or an EBCDIC string. Formerly, only EBCDIC was allowed. </td></tr>
<tr><th>AllowNull=<i><b>bool</b></i></th>
<tr><th>AllowNull=<i><b>bool</b></i></th>
<td>This Boolean, name required, optional parameter determines whether an input null character is considered invalid.
<td>This Boolean, name required, optional parameter determines whether an input null character is considered invalid.
Line 24: Line 24:
==Usage notes==
==Usage notes==
<ul>
<ul>
<li>InvalidCharacterPosition returns zero if its argument string is:
<li><var>InvalidCharacterPosition</var> returns zero if its argument string is:
<ul>
<ul>
<li>Unicode, and all characters are legal in an XML document (the only illegal
<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>).
character is the null character, if <code>AllowNull=False</code>).
<li>EBCDIC, and all characters are translatable to Unicode 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>


Line 37: Line 37:
node were the EBCDIC "control characters."
node were the EBCDIC "control characters."
<li>Like any shared method, the method object here can be an object of the
<li>Like any shared method, the method object here can be an object of the
class of the method (XmlDoc), null or not, or it can simply be a
class of the method (<var>XmlDoc</var>), null or not, or it can simply be a
class name qualifier:
class name qualifier:
<p class="code">%pos = %myDoc:InvalidCharacterPosition(%str)
<p class="code">%pos = %myDoc:<var>InvalidCharacterPosition</var>(%str)


%pos = %(XmlDoc):InvalidCharacterPosition(%str)
%pos = %(<var>XmlDoc</var>):<var>InvalidCharacterPosition</var>(%str)
</p>
</p>


Line 47: Line 47:
The first type of invocation is '''not''' meant to imply
The first type of invocation is '''not''' meant to imply
that the method actually operates on <tt>%doc</tt>.
that the method actually operates on <tt>%doc</tt>.
<li>With the introduction of this method, the IsValidString function is
<li>With the introduction of this method, the IsValid<var>String</var> function is
deprecated.
deprecated.
<li>This method was actually introduced into version 6.9 of [[Janus SOAP]], but its documentation
<li>This method was actually introduced into version 6.9 of [[Janus SOAP]], but its documentation

Revision as of 17:46, 25 January 2011

Detect invalid characters (XmlDoc class)


This shared function 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

%pos 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 and is one way to invoke the method. See the "Usage Notes," below for more about invoking this method.
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.
AllowNull=bool This Boolean, name required, optional parameter 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 7.6, the invalid characters of an Element or Attribute node were the EBCDIC "control characters."

  • Like any shared method, the method object here can be an object of the class of the method (XmlDoc), null or not, or it can simply be a class name qualifier:

    %pos = %myDoc:InvalidCharacterPosition(%str) %pos = %(XmlDoc):InvalidCharacterPosition(%str)

    Note: The first type of invocation is not meant to imply that the method actually operates on %doc.

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

See also