AllowXmlElement (XmlDoc property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 19: Line 19:
{{Template:XmlDoc:AllowXmlElement syntax}}
{{Template:XmlDoc:AllowXmlElement syntax}}
===Syntax terms===
===Syntax terms===
<dl>
<table class="syntaxTable">
<dt>%bool
<tr><th>%bool</th>
<dd>The Boolean enumeration value of <i>doc</i>'s AllowXmlElement property.
<td>The Boolean enumeration value of <i>doc</i>'s AllowXmlElement property. For more information about these enumerations, see [[Using Boolean enumerations]]. </td></tr>
For more information about these enumerations, see [[Using Boolean enumerations]].
<tr><th>doc</th>
<dt>doc
<td>An XmlDoc object expression.</td></tr>
<dd>An XmlDoc object expression.
</table>
 
</dl>


==Usage notes==
==Usage notes==

Revision as of 17:50, 22 January 2011

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

AllowXmlElement is a member of the 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.