Exploration of W3C Document Object Model

Exploration of W3C Document Object Model

Let’s consider an example of implementation of HarePoint 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="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns oap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetWebPartPage xmlns="http://microsoft.com/sharepoint/webpartpages">
      <documentName>Lists/Links/EditForm.aspx</documentName>
    </GetWebPartPage>
  </soap:Body>
</soap:Envelope>

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.Text;
using System.Diagnostics;
using System.Xml;

public class Tester
{
	static object main(
		 MAPILab.SharePoint.Explorer.CodeForm thisForm
		)
	{
		XmlDocument document = new XmlDocument();
		document.Load(@"C:\test.xml");
		return document;
	}
}

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.

 

Browser of the object model
Click to open real size screenshot

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.

Our valued customers

HarePoint products are recognized by thousands of companies

  • Foley Hoag LLP
  • Synopsys
  • Immofinanz
  • FUJITSU
  • Wargaming Interactive