XmlDoc (XmlNodelist function)

From m204wiki
Revision as of 00:33, 7 December 2010 by Admin (talk | contribs) (1 revision)
Jump to navigation Jump to search

XmlDoc object of XmlNode or XmlNodelist

XmlDoc is a member of the XmlNode and XmlNodelist classes.

This function returns the XmlDoc associated with the method object.

Syntax

  %doc = nod:XmlDoc
  %doc = nlis:XmlDoc

Syntax Terms

%doc
An XmlDoc, which will be set to point to the document associated with nod or nlis.
nod
An XmlNode expression.
nlis
An XmlNodelist expression.

Usage Notes

  • The XmlDoc function can be used when it is necessary, for example, to get or set XmlDoc properties (such as ??Namespace) given an XmlNode or XmlNodelist.

Examples

  • In the following example, the Namespace property is temporarily changed during the execution of a subroutine:
        Subroutine disp(%n Object XmlNode)
        %old Enumeration XmlNamespaceSetting
        %old = %n:XmlDoc:Namespace
        %n:XmlDoc:Namespace = 'Ignore'
        %n:SelectSingleNode('*[model<"C3PO"']):Print
        %n:XmlDoc:Namespace = %old
        End Subroutine
    
  • You can also use the XmlDoc function to access the Root node (and then, optionally, to use an XPath expression which is in effect an absolute expression) with an empty XmlNodelist, as in the following example:
        Subroutine disp(%l Object XmlNodelist)
        If %l:Count EQ 0 Then
           Print 'Nodelist empty; here is document:'
           %l:XmlDoc:Print
        Else
           ...
    

Request-Cancellation Errors

  • XmlDoc has no request cancellation errors.