How to Create and Process XML

<< Click to Display Table of Contents >>

Navigation:  Concepts >

How to Create and Process XML

There are two ways allowing creating and processing XML format.

XML as simple string

XML can be created as a simple string with the help of any programming language This is the most simple way that can be recommended for initial investigation and for many projects where there is no need to handle complicated XML files.

A simple way to work with CAD XML API:

1. Look at the example XML files and How to help section.

2. Create XML strings on the basis of demo examples to implement the required features.

3. You can either load XML files from HDD or add all these XML texts as string constants directly to the application source code.

We recommend to use the Format() function (which is present in all popular programming languages) to insert data to XML strings.

C# example for calling line:


        string command =

            @"<?xml version=""1.0"" encoding=""UTF-8""?>

              <cadsofttools version=""2.0"">

                <command text=""Line""/>


  string result = CADEditorX.ProcessXML(command);

XML obtained with the help of the OnProcess callback function can be also parsed using the common functions used to parse strings in your programming language.

C# example for the OnProcess callback:


string result = CADEditorX.ProcessXML("");


XML Parser

There are many XML parsers that are suggested for all popular development languages. Microsoft Windows has the DOM technology for handling XML, which is very powerful but not very fast. There are a lot of simple and fast XML parsers that are suggested as opensource for many programming languages.

It is recommended to use XML parser to implement complicated tasks with the help of CAD XML API.

Go to CADEditorX