CAD XML API Document and XML API Instruction

  XML_API > CAD XML API Reference > Introduction  >

CAD XML API Document and XML API Instruction

Previous pageReturn to chapter overviewNext page

All commands of the XML API are text documents created according to roles of XML Specification produced by the W3C.

For the correct  XML API understanding it is very important to know two terms on which the work of XML API is based:

1. XML API document
2.  XML API instruction

An XML API instruction is a part of an XML API document.  The XML API document should contain at least one instruction, however, the quantity of the instructions in one XML API document can be more than one. The quantity of the instructions in an XML API document is limited only by size of the computer RAM that's necessary for the correct processing of all instructions.

The source code for an XML API document should contain:

XML document declaration
start-tag of the root node
XML API Command(s)
end-tag of the root node

Tags

start-tag < >
end-tag </>
empty-element tag </>

Comments

Comments may appear anywhere in an XML API document outside other markup. Comments cannot appear before the XML declaration. Comments start with "<!--" and end with "-->".

Example

<!-- XML document declaration -->
<?xml version="2.0" encoding="UTF-8"?>
<!-- start-tag of the root node -->
<cadsofttools version="2">     
   <!-- XML command GET -->
   <get/>
<!-- end-tag of the root node -->
</cadsofttools>

Note: XML API supports Unicode and we strongly recommend to use Unicode encoding of an XML API document to prevent possible loss of data.

An XML API command is an element of an XML document which either begins with a start-tag and ends with a matching end-tag or consists only of an empty-element tag.

The characters between the start- and end-tags define the XML API command.

An XML API command may have a list of input parameters, if any, the parameters are defined with attributes consisting of a name/value pair that exists between the start-tag and end-tag of  the XML API command.

Note: Letter case is ignored in XML API commands, that means that you can write both <get>  or <Get> with the same result.

 

Example

command GET, the command may have no parameters:

<!-- XML document declaration -->
<?xml version="1.0" encoding="UTF-8"?>
<!-- start-tag of the root node -->
<cadsofttools version="2.0">     
   <!-- XML command GET -->
   <get> </get>
<!-- end-tag of the root node -->
</cadsofttools> 

command GET can be written also with empty-element tag:

<!-- XML document declaration -->
<?xml version="1.0" encoding="UTF-8"?>
<!-- start-tag of the root node -->
<cadsofttools version="2.0">     
   <!-- XML command GET with empty-element tag-->
   <get/>
<!-- end-tag of the root node -->
</cadsofttools>

commands APPLY, command with parameters list

<?xml version="1.0" encoding="UTF-8"?>
<cadsofttools version="2.0">
  <Select Handle="@1"/>
<!-- XML API command APPLY parameters are lineweight="7" point1="50,10,0" Color="0;33;" -->  
  <apply lineweight="7" point1="50,10,0" Color="0;33;"/>
  <UnSelect Handle="@1"/>
  <!-- Zoom rect of tne selected entities to the screen -->
  <ShowSelectedEntities/>
</cadsofttools>

 

How to Create and Process XML

Go to ABViewer