How to Create and Process XML

  XML_API > CAD XML API Reference > Introduction  > CAD XML API Document and XML API Instruction >

How to Create and Process XML

Previous pageReturn to chapter overviewNext page

There are two ways of creating and processing XML format.

XML as simple string

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

The simple way of working with CAD XML API:

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

2. Create XML files on base of demo examples in order to implement the needed functional.

3. Use XML files from previous point with sometimes Format() command in your application. You can both load XML files from HDD or add all these XML texts as string constants directly to application source code.

C# example for calling line:

 

        string command =

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

              <cadsofttools version=""1"">

                <command text=""Line""/>

              </cadsofttools>";

  string result = CADEditorX.ProcessXML(command);

 

XML which is get by callback OnProcess function can be also parsed with usage of common functions to parse strings in your programming language.

C# example for callback OnProcess:

 

string result = CADEditorX.ProcessXML("");

 

XML Parser

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

Usage of XML parser is recommended for implemented complicated tasks with CAD XML API.

Go to ABViewer