Aim of the project - the creation of the interpreter which processes the description of data structure on XML Schema(XSD). The interpreter may perform the folowing functions:
- Reading Xml-files, filled by the User, for editing binary data in accordance with the needed XSD.
- Creating Xml-files from binary data in accordance with the needed XSD. It is very convenient for control binary data, transmitted through communication channels, instead of ordinary sniffers,which present binary data in hexadecimal format only.
S/W includes the following:
Xsd2StructBuilder.exe — a dialog utility for creation of XML Schemas, similar to include files for C-language, empty XML-files and files with a list of data structure full named variables.
Xsd2Struct.exe - a console utility.
This utility reads XML Schemas, created by Xsd2StructBuilder.exe or any text editor and may be used as a separate Server, connected via TCP/IP for receiving and sending binary data, which structures are described by the XML Schemas. This utility also creates similar include files for C-language, empty XML-files and files with list of data structure full named variables, such as Xsd2StructBuilder.exe. In case the utility receives binary data via a TCP/IP channel, it creates an xml-file with values of data structure variables.
Demo.exe – a console application works as a client with the server of Xsd2Struct.exe.
It receives binary data from Xsd2Struct.exe and sends binary data to it. The User may test the Trial version of Xsd2Struct.exe by Demo.exe. Demo.zip contains a sample of using the communication protocol between a client of User's Application and the server of Xsd2Struct.exe. Rules for Schemas creation are described in Table 1 and Table 2.
|Elements||Mandatory Attributes||Optionally Attributes||Included Elements|
Table 1. Elements, their attributes and included elements
Certain Elements have special types. These are shown in Table 2.
|Elements with types||Type values|
|Structure||One of previous designed Template names|
|Item_enum||One of previous designed Enum names|
Table 2. Type values
Values of attributes
Schema Element must be unique and will be used for selecting the necessary schema.
Using the Code
The User's Application may connect with Xsd2Struct.exe server via a TCP/IP channel. The User's Application can get binary data from Xsd2Struct.exe server or send binary data to it. Received binary data will be printed in accordance with their schema. This output will include the list of full-name variables and their values.
Sample of schema:
<Schema name="schema3" id="1">
<Item name="red" id="1"/>
<Item name="green" id="2"/>
<Item name="blue" id="3"/>
<Item name="white" id="4"/>
<Item name="black" id="5"/>
<Item name="x" type="int"/>
<Item name="y" type="int"/>
<Item_enum name="pen" type="COLOR" nrepetitions="2"/>
<Structure name="point" type="POINT"/>
<Item name="z" type="int" nrepetitions="2"/>
<Item name="array" type="char" nrepetitions="10" visibility="0"/>
<Structure name="coord" type="RECTANGLE" nrepetitions="3"/>
Generated include-file for this schema:
Detailed information may be found on the site http://www.x2st.com.
Used languages - C++, XML.
Points of Interest
In order to prepare documentation for this project, I used "Doxygen" .
This is a first version.