TagDataTranslation 0.3.1

There is a newer version of this package available.
See the version list below for details.
Install-Package TagDataTranslation -Version 0.3.1
dotnet add package TagDataTranslation --version 0.3.1
<PackageReference Include="TagDataTranslation" Version="0.3.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TagDataTranslation --version 0.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TagDataTranslation, 0.3.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install TagDataTranslation as a Cake Addin
#addin nuget:?package=TagDataTranslation&version=0.3.1

// Install TagDataTranslation as a Cake Tool
#tool nuget:?package=TagDataTranslation&version=0.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


Tag Data Translation implemented according to the GS1 EPC Tag Data Translation 1.6 specification (http://www.gs1.org/epc/tag-data-translation-standard) for RAIN RFID, and updated for Tag Data Standard 1.11. Comes with unit tests and a demonstration application. Online accessible at https://www.mimasu.nl/tdt.

An online demo is available at https://www.mimasu.nl.

The following schemes are supported:

  • ADI-var
  • CPI-96, CPI-var
  • GTDI-96, GDTI-174
  • GIAI-96, GIAI-202
  • GID-96
  • GRAI-96, GRAI-170
  • GSRN-96
  • GSRNP-96
  • ITIP-110, ITIP-212
  • SGCN-96
  • SGLN-96, SGLN-195
  • SGTIN-96, SGTIN-198
  • SSCC-96
  • USDOD-96

The following programming languages are supported:

  • C# .NET Framework 4.0 (Microsoft and Xamarin Mono runtime)
  • C# .NET Standard 1.4


The following code is an example on how to use the library, to go from a GTIN and serial to hexadecimal.

TDTEngine engine = new TDTEngine ();
string epcIdentifier = @"gtin=00037000302414;serial=10419703"
string parameterList = @"filter=3;gs1companyprefixlength=7;tagLength=96";
string binary = engine.Translate(epcIdentifier, parameterList, @"BINARY");
string binaryHex = engine.BinaryToHex(binary);

Or the other way around.

TDTEngine engine = new TDTEngine ();
string epcIdentifier = engine.HexToBinary(@"30340242201d8840009efdf7");
string parameterList = @"tagLength=96";
string legacy = engine.Translate(epcIdentifier, parameterList, @"LEGACY");


The library follows the client API as defined in the standard and there are some additional helper functions.


public String translate(String epcIdentifier, String parameterList, String outputFormat)

Translates epcIdentifier from one representation into another within the same coding scheme.

Parameter Description
epcIdentifier The epcIdentifier to be converted. This should be expressed as a string, in accordance with one of the grammars or patterns in the TDT markup files, i.e. a binary string consisting of characters '0' and '1', a URI (either tag-encoding or pure-identity formats), or a serialized identifier expressed as in Table 3.
parameterList This is a parameter string containing key value pairs, using the semicolon [';'] as delimiter between key=value pairs. For example, to convert a GTIN code the parameter string would look like the following: filter=3;companyprefixlength=7;tagLength=96
outputFormat The output format into which the epcIdentifier SHALL be converted. The following are the formats supported: BINARY, LEGACY, LEGACY_AI, TAG_ENCODING, PURE_IDENTITY

The converted value into one of the above formats as String.


TDTTranslationException – Throws exceptions due to the following reason:

  1. TDTFileNotFound Reports if the engine could not locate the configured definition file to compile.
  2. TDTFieldBelowMinimum Reports a (numeric) Field that fell below the decimalMinimum value allowed by the TDT markup
  3. TDTFieldAboveMaximum Reports a (numeric) Field that exceeded the decimalMaximum value allowed by the TDT markup
  4. TDTFieldOutsideCharacterSet Reports a Field containing characters outside the characterSet range allowed by the TDT markup
  5. TDTUndefinedField Reports a Field required for the output or an intermediate rule, whose value is undefined
  6. TDTSchemeNotFound Reported if no matching Scheme can be found via prefixMatch
  7. TDTLevelNotFound Reported if no matching Level can be found via prefixMatch
  8. TDTOptionNotFound Reported if no matching Option can be found via the optionKey or via matching the pattern
  9. TDTLookupFailed Reported if lookup in an external table failed to provide a value – reports table URI and path expression.
  10. TDTNumericOverflow Reported when a numeric overflow occurs when handling numeric values such as serial number.


public PrefixLengthResult GetPrefixLength(string input)

Gets the GS1 Prefix Length for the given identifier. Based on the gcpprefixformatlist.xml file from GS1 (GCP Length Table, https://www.gs1.org/standards/bc-epc-interop).

Parameter Description
input Identifier for which to find the GS1 Prefix Length. Input as string.

An object with the following properties.

Property Description
Prefix The full GS1 Prefix as a string.
Length The length of the GS1 Prefix as integer.


public Dictionary<int, string> GetFilterValueTable(string scheme)

Gets the Filter Value table for the provided scheme.

Parameter Description
scheme The GS1 EPC scheme for which to retrieve the Filter Value Table. Input as string.

A dictionary with an integer as key (Filter Value) and a string as value (description).


This library is dual-licensed:

  • GNU Affero General Public License version 3
  • Commercial license, contact tdt@dannyhaak.nl for more details

The included XML and XSD artifacts are (c) by GS1 (https://www.gs1.org/epc/tag-data-translation-standard).

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.5 4,459 12/9/2019
1.1.4 241 12/9/2019
1.1.3 258 12/9/2019
1.1.3-beta 278 10/22/2019
1.1.2 537 10/22/2019
1.1.2-beta 245 10/21/2019
1.1.1-beta 319 5/22/2019
1.1.0 712 2/3/2019
1.1.0-beta1 482 10/16/2018
1.0.2 1,700 10/8/2018
1.0.1 725 6/7/2018
1.0.0 878 3/9/2018
0.3.1 718 7/23/2017
0.3.1-beta 553 4/23/2017
0.2.1 785 10/19/2016
0.2.0 672 8/4/2016
0.1.0 5,147 5/30/2016