ComponentOne XmlEditor for WinForms: XmlEditor for WinForms Task-Based Help > Loading an XHTML Document from a File

Loading an XHTML Document from a File

You can load an XHTML document into the C1XmlEditor using the LoadXml method.

1.   In the Visual Studio Solution Explorer, right-click the project name, select New Folder, and name it Xhtml.

2.   Place the XHTML document you would like to load into this folder. For this example, we will use a document named "galaxy.htm".

3.   Click the View menu and select Code to switch to Source view, if necessary.

4.   Add the following statements to your project.

      Visual Basic

Imports C1.Win.XmlEditor

Imports System.IO

      C#

using C1.Win.XmlEditor;

using System.IO;

5.   Add the following code to the Page_Load event. This code uses the LoadXml method to load your XHTML document into the C1XmlEditor. You will need to update the file path to the location of the XHTML document on your machine.

      Visual Basic

c1XmlEditor1.LoadXml("C:\galaxy.htm")

      C#

c1XmlEditor1.LoadXml(@"C:\galaxy.htm");

6.   Run the project and the C1XmlEditor will show your XHTML document.


Send comments about this topic to ComponentOne.
Copyright © 1987-2009 ComponentOne LLC. All rights reserved.