This project is read-only.

Exploration of W3C Document Object Model (DOM)

Let’s consider an example of implementation of MAPILab Explorer for SharePoint.

Web service called WebPartPages.asmx, which is included into Windows SharePoint Services, gets requests from client applications in form of xlm-packages. This is an example of such a request:

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="" 
    <GetWebPartPage xmlns="">

Our task is to consider the contents of this package.

To solve this problem let’s use the System.Xml.XmlDocument class. Let’s put the above mentioned example in any file, for instance, C:\test.xml. Then let’s open a new code window and change the text of the ‘main’ method in the following way:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using MAPILab.SharePoint.Explorer.CodeForm;
using MAPILab.SharePoint.Explorer.Utilities.ScriptRunner;
using System.Xml; 

public class Tester
    static void Main(
         MAPILab.SharePoint.Explorer.CodeForm.MLCodeForm thisForm
        ,MAPILab.SharePoint.Explorer.Utilities.ScriptRunner.MLBrowser browser
        XmlDocument document = new XmlDocument();
        // Output browser configuration
        //browser.Text = "Browser window";
        //browser.DisplayMode = MAPILab.SharePoint.Explorer.Utilities.ScriptRunner.DisplayMode.Expanded;
        browser.ReturnValue = document;
Visual Basic
Imports System
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Text
Imports MAPILab.SharePoint.Explorer.CodeForm
Imports MAPILab.SharePoint.Explorer.Utilities.ScriptRunner
Imports System.Xml

Public Class Tester
    Shared Sub Main(ByVal thisForm As MAPILab.SharePoint.Explorer.CodeForm.MLCodeForm, 
ByVal browser As MAPILab.SharePoint.Explorer.Utilities.ScriptRunner.MLBrowser)
        Dim document As XmlDocument = new XmlDocument()
        ' Output browser configuration
        'browser.Text = "Browser window"
        'browser.DisplayMode = MAPILab.SharePoint.Explorer.Utilities.ScriptRunner.DisplayMode.Expanded
        browser.ReturnValue = document
    End Sub
End Class

This source code loads the contents of the xml-file and then returns created XmlDocument for further examination with the help of the browser of the object model.

Xml document

Now we can visually examine our xml in the form of the DOM-model. The node, which is marked out in the picture, includes the name of the document. It is called from the Microsoft SharePoint Designer.



Last edited Nov 27, 2009 at 4:25 PM by EugenMakarkhin, version 9


No comments yet.