www.altova.com
Previous  Top  Next

General Usage and Example


The classes and methods you can use are as described in the COM Interface section, but are in the namespace Altova.AltovaXML. They are listed in the following sections. The starting point is the Altova.AltovaXML.Application object. When you create this object, a connection to a new AltovaXML COM server object is created. The object model is shown in the diagram below.

 

ax_object_model_dotnet

 

 

Example

How to use the AltovaXML classes and methods in the .NET framework is shown in the C# code for a button event listed below:

 

private void button1_Click(object sender, System.EventArgs e)

{

       Altova.AltovaXML.ApplicationClass appXML = new Altova.AltovaXML.ApplicationClass();

       Altova.AltovaXML.XMLValidator XMLValidator = appXML.XMLValidator;

       XMLValidator.InputXMLFromText = "<test>Is this data well-formed? <a></test>";

       if ( XMLValidator.IsWellFormed() )

       {

       MessageBox.Show( this, "The input data is well-formed") ;

       }

       else

       {

       MessageBox.Show( this, "The input data is not well-formed") ;

       }

}

 

The code listing above does the following:

 

1.The Altova.AltovaXML.ApplicationClass object is created, which creates a connection to a new AltovaXML COM server object.
2.The XML Validator functionality is called using Altova.AltovaXML.XMLValidator.
3.The InputXMLFromText property of Altova.AltovaXML.XMLValidator submits the input XML data.
4.The IsWellFormed method of Altova.AltovaXML.XMLValidator checks whether the submitted XML data is well-formed, returning TRUE or FALSE.

 

For more detailed examples, see the example files in the Examples folder in the application folder.

 

 

 


Previous  Top  Next

© 2008 Altova