AllowXmlElement (XmlDoc property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 1: Line 1:
{{Template:XmlDoc:AllowXmlElement subtitle}}
{{Template:XmlDoc:AllowXmlElement subtitle}}


This property indicates whether or not the method object XmlDoc allows the
This property indicates whether or not the method object <var>XmlDoc</var> allows the
deserialization of an XML document that contains Elements that begin with the
deserialization of an XML document that contains Elements that begin with the
character sequence <tt>xml</tt> (regardless of case).
character sequence <tt>xml</tt> (regardless of case).
Line 13: Line 13:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%bool</th>
<tr><th>%bool</th>
<td>The Boolean enumeration value of <i>doc</i>'s AllowXmlElement property. For more information about these enumerations, see [[Using Boolean enumerations]]. </td></tr>
<td>The Boolean enumeration value of <i>doc</i>'s <var>AllowXmlElement</var> property. For more information about these enumerations, see [[Using Boolean enumerations]]. </td></tr>
<tr><th>doc</th>
<tr><th>doc</th>
<td>An XmlDoc object expression.</td></tr>
<td>An <var>XmlDoc</var> object expression.</td></tr>
</table>
</table>


Line 36: Line 36:
However, as shown in "Examples," below,
However, as shown in "Examples," below,
it is easy to use the LoadXml method to accomplish this.
it is easy to use the LoadXml method to accomplish this.
<li>The AllowXmlElement method is new in ''Sirius Mods'' version 7.3, and it
<li>The <var>AllowXmlElement</var> method is new in ''Sirius Mods'' version 7.3, and it
has also been provided by maintenance for version 6.8 and
has also been provided by maintenance for version 6.8 and
version 7.2.
version 7.2.
Line 42: Line 42:
==Examples==
==Examples==
<ul>
<ul>
<li>The following example obtains the string value of the AllowXmlElement property:
<li>The following example obtains the string value of the <var>AllowXmlElement</var> property:
<p class="code">%str = %doc:AllowXmlElement:ToString
<p class="code">%str = %doc:<var>AllowXmlElement</var>:To<var>String</var>
</p>
</p>


Taking advantage of the implicit-ToString feature added in ''Sirius Mods'' version 7.3
Taking advantage of the implicit-To<var>String</var> feature added in ''Sirius Mods'' version 7.3
(see [[??]] refid=entostr.),
(see [[??]] refid=entostr.),
you can print this value directly by using this:
you can print this value directly by using this:
<p class="code">Print %doc:AllowXmlElement
<p class="code">Print %doc:<var>AllowXmlElement</var>
</p>
</p>
<br>
<br>
<li>The following request prints <tt>%d:allowXmlElement is True</tt>:
<li>The following request prints <tt>%d:allowXmlElement is True</tt>:
<p class="code">Begin
<p class="code">Begin
%d Object XmlDoc Auto New
%d <var>Object</var> <var>XmlDoc</var> Auto New
%d:AllowXmlElement = true
%d:<var>AllowXmlElement</var> = true
%d:LoadXml('<t>Test<xmlnode></xmlnode></t>')
%d:LoadXml('<t>Test<xmlnode></xmlnode></t>')
PrintText {~} is {%d:allowXmlElement}
PrintText {~} is {%d:allowXmlElement}
Line 62: Line 62:
'''Note:'''
'''Note:'''
Using the PrintText statement is described in [[??]] refid=prntext..
Using the PrintText statement is described in [[??]] refid=prntext..
Printing an enumeration value without a ToString method
Printing an enumeration value without a To<var>String</var> method
is described in the first "Note"
is described in the first "Note"
in [[??]] refid=crenums..
in [[??]] refid=crenums..

Revision as of 17:46, 25 January 2011

May Element names begin with "xml"? (XmlDoc class)


This property indicates whether or not the method object XmlDoc allows the deserialization of an XML document that contains Elements that begin with the character sequence xml (regardless of case).

A Boolean value of True allows such deserializations. The default value, False, cancels the request if such a deserialization is attempted.

Syntax

%currentBoolean = doc:AllowXmlElement doc:AllowXmlElement = newBoolean

Syntax terms

%bool The Boolean enumeration value of doc's AllowXmlElement property. For more information about these enumerations, see Using Boolean enumerations.
doc An XmlDoc object expression.

Usage notes

  • Deserializing Elements whose name begins with "xml" was restricted due to the following excerpt from the XML standard:
    • Names beginning with the string "xml", or any string which would match (('X'|'x') ('M'|'m') ('L'|'l')), are reserved for standardization in this or future versions of this specification.

    Therefore, you should use care with element names: using an element name such as XML makes you vulnerable to a change in the standards that would leave your document incompatible with them. Note: This property does not allow the AddElement method to add an element with a name that starts with "xml". However, as shown in "Examples," below, it is easy to use the LoadXml method to accomplish this.

  • The AllowXmlElement method is new in Sirius Mods version 7.3, and it has also been provided by maintenance for version 6.8 and version 7.2.

Examples

  • The following example obtains the string value of the AllowXmlElement property:

    %str = %doc:AllowXmlElement:ToString

    Taking advantage of the implicit-ToString feature added in Sirius Mods version 7.3 (see ?? refid=entostr.), you can print this value directly by using this:

    Print %doc:AllowXmlElement


  • The following request prints %d:allowXmlElement is True:

    Begin %d Object XmlDoc Auto New %d:AllowXmlElement = true %d:LoadXml('<t>Test<xmlnode></xmlnode></t>') PrintText {~} is {%d:allowXmlElement} End

    Note: Using the PrintText statement is described in ?? refid=prntext.. Printing an enumeration value without a ToString method is described in the first "Note" in ?? refid=crenums..

Request-Cancellation Errors (for set method)

  • %bool is an invalid value.

See also