Class DLSyntaxParser

java.lang.Object
tools.pantheum.gaia.gs1.syntax.digitallink.DLSyntaxParser

public class DLSyntaxParser extends Object
Extracts GS1 Application Identifier elements from an uncompressed GS1 Digital Link URI into a list of GS1AIObjectElement objects.

Parsing rules (GS1 Digital Link Standard: URI Syntax, release 1.7.0):

  • The input must be an absolute HTTP(S) URL (GE-L001–GE-L003 otherwise).
  • The path contains exactly one primary identification key as an /ai/value pair (§4.3); arbitrary custom path segments may precede it (§6.1.1).
  • Subsequent /ai/value path pairs are key qualifiers, admitted and ordered per primary key (§4.9).
  • Query parameters with all-numeric keys are data attribute AIs (§4.10); non-numeric keys are extension parameters and are ignored, as are the reserved keywords linkType and context.
  • Percent-encoded characters in values are decoded (§4.2).

Parsing is two-phase, mirroring AISyntaxParser:

  1. Phase 1 – Extract: walk the URL path and query, collecting AI/value pairs and their GS1Constants.DigitalLinkAIType roles, raising a structural Digital Link error (GE-L001–GE-L012) per violation.
  2. Phase 2 – Tokenise: render the pairs as a GS1 element string and delegate to AISyntaxParser so that elements carry the same component slices and value checks as element-string parsing; each element is then tagged with its Digital Link role.

All elements and errors collected before a structural error are still returned so that callers can report as much context as possible.