SDXF

With this format to almost any structured data can be recorded for the purpose of exchange. This format is ideal for the file format as well as a networking message format.

SDXF allows a structure to any depth; the individual data elements are self- descriptive. The format is deliberately kept simple, yet it should be transparent, meaning that the programs on basic functions and tools to access the data elements and the programmer as the user does not need to determine the exact structure of the data structure to worry about.

SDXF also supports the exchange of data across different computer architectures away by a transparent implementation of the data.

SDXF is authentic published as Internet RFC 3072.

Structured data structures that are recognized and processed by the programs involved as such. A normal text is indeed in line, heels and so on "structured", but is considered not structured in terms of this definition.

Example

Two companies that are in a business relationship, decide their invoicing to handle electronically. A " statement " is then an electronic document with the following hierarchically nested structure.

STATEMENT   │   ├ ─ RECHNUNGS_NR   ├ ─ DATE   ├ ─ ANSCHRIFT_SENDER   │ ├ ─ NAME   │ ├ ─ NAME   │ ├ ─ ROAD   │ ├ ─ postcode   │ ├ ─ PLACE   │ └ ─ LAND   ├ ─ ANSCHRIFT_EMPFÄNGER   │ ├ ─ NAME   │ ├ ─ NAME   │ ├ ─ ROAD   │ ├ ─ postcode   │ ├ ─ PLACE   │ └ ─ LAND   ├ ─ RECHNUNGS_SUMME   ├ ─ EINZELPOSTEN_ALLE   │ ├ ─ INDIVIDUAL ITEMS   │ │ ├ ─ NUMBER   │ │ ├ ─ ITEM NUMBER   │ │ ├ ─ ARTICLE TEXT   │ │ ├ ─ PRICE   │ │ └ ─ TOTAL   │ └ ─ ...   ├ ─ CONDITIONS   ... Similar and more complex structures it is in SDXF cover. The basic structural element is the " chunk ". The entire structure is a SDXF chunk and a chunk may consist of a plurality of chunks.

A chunk is very simple. It consists of a header ( header) of six bytes, followed by the actual data. The header contains a description of the chunk is stored as a 2-byte binary number ( chunk ID), as well as the length of the following data and an identification of the type of data and any additional information ( compression, encryption, and others).

The data - type information as to whether the data consist of text, whether they represent a binary number ( integer or floating point) or whether the data from a number of other chunks composed ( structured chunk ).

The existence of structured chunks provides an easy way to grab hierarchical structures as above STATEMENT in a SDXF structure. First, each of those concepts ( BILL RECHNUNGS_NR, DATE, ANSCHRIFT_SENDER, etc ) a unique number ( chunk ID) must be assigned from the Zahlenbreich 1 to 65535. Then be the first chunk of structured chunk STATEMENT ( stage 1) to construct, which consist more of a set of chunks Level 2: RECHNUNGS_NR, DATE, ANSCHRIFT_SENDER, ANSCHRIFT_EMPFÄNGER, RECHNUNGS_SUMME, EINZELPOSTEN_ALLE, CONDITIONS. The 2nd stage Some of these chunks are in turn structures: the two addresses and EINZELPOSTEN_ALLE. When you date one has the possibility to specify this in text format, for example in the form YYYY- MM-DD (ISO 8601) or as a structure consisting of three numeric chunks YEAR, MONTH, DAY.

In RFC a chunk is described on page 2 exactly:

The definition of SDXF concept provides that a programmer works with a well-defined set of editing functions with the SDXF structures.

Basic Functions

Example of creating program

For the accounting example a builder might look something like this:

Init ( sdx, buffer size = 1000); / / Initialize the SDXF parameter structure sdx create ( sdx, id = STATEMENT, datatype = STRUCTURED ); / / Start of main structure create ( sdx, id = RECHNUNGS_NR, datatype = NUMERIC, value = 123456); / / Chunk elemental create ( sdx, id = DATE datatype = CHAR, value = " 2005-06-17 "); / / Chunk elemental create ( sdx, id = ANSCHRIFT_SENDER, datatype = STRUCTURED ); / / Subtree create ( sdx, ID = NAME, datatype = CHAR, value = " Karl Napp "); / / Subtree ... create ( sdx, id = COUNTRY, datatype = CHAR, value = " Switzerland "); / / Subtree leave; / / Complete the substructure ANSCHRIFT_SENDER ... leave; / / Enter the main structure STATEMENT The syntax is here for the sake of simplicity fictitious, a complete example in C can be found on the PINPI site.

Example of a reading program

The reading is followed by the given structure:

Init ( sdx, container = addr SDXF structure); / / Initialize the SDXF parameter structure sdx enter ( sdx ); / / " Entry" to the billing structure   do while ( sdx.rc == SDX_RC_ok ) {      switch ( sdx.Chunk_ID )     {         case RECHNUNGS_NR:           extract ( sdx );           HOST = sdx.value; / / Integer numeric values ​​are stored in value           break;           / /         case DATE:           extract ( sdx );           strcpy ( right date, sdx.data ); / / Data is a pointer to the extracted string           break;           / /         case ANSCHRIFT_SENDER:           enter ( sdx ); / / Since the ADDRESS is a structure           do while ( sdx.rc == SDX_RC_ok )            ...           break;        ...     } } The individual SDXF elements ( chunks ) are created piece by piece. This may seem awkward, but:

If the entire structure can be processed as an editable text file, the SDEF format can be used.

Footnotes

719688
de