diff --git a/src/BaseTypes/INamespaced.ts b/src/BaseTypes/INamespaced.ts index 86fff834e3309ad017a871923c0cd632e243162a..595830e9fa01b48c4d01b2345dd4a48033727324 100644 --- a/src/BaseTypes/INamespaced.ts +++ b/src/BaseTypes/INamespaced.ts @@ -1,3 +1,3 @@ export interface INamespaced { - get namespace(): string; + get ns(): string; } diff --git a/src/DCC.ts b/src/DCC.ts index f7bb65b50edab18f38ae50261b17c45b0707e299..c2cdab9e92b8445f2235540a357c199553dc921a 100644 --- a/src/DCC.ts +++ b/src/DCC.ts @@ -15,31 +15,31 @@ export const DCC: ISchemaInformation = { }; export class DCCXMLElement extends XMLElement implements INamespaced { - get namespace() { + get ns() { return DCC.namespace; } } export class DCCXMLBoolean extends XMLBoolean implements INamespaced { - get namespace() { + get ns() { return DCC.namespace; } } export class DCCXMLNumber extends XMLNumber implements INamespaced { - get namespace() { + get ns() { return DCC.namespace; } } export class DCCXMLDate extends XMLDate implements INamespaced { - get namespace() { + get ns() { return DCC.namespace; } } export class DCCXMLList extends XMLList implements INamespaced { - get namespace() { + get ns() { return DCC.namespace; } } @@ -89,6 +89,7 @@ export class DigitalCalibrationCertificateType extends DCCXMLElement { * The entries in this area are basically the same and regulated in all DCCs. */ export class AdministrativeDataType extends DCCXMLElement { dccSoftware: SoftwareListType; + refTypeDefinitions?: RefTypeDefinitionListType; coreData: CoreDataType; items: ItemListType; calibrationLaboratory: CalibrationLaboratoryType; @@ -99,6 +100,7 @@ export class AdministrativeDataType extends DCCXMLElement { constructor(el: Partial<AdministrativeDataType> = {}) { super(el); this.dccSoftware = new SoftwareListType(el.dccSoftware); + if (el.refTypeDefinitions) this.refTypeDefinitions = new RefTypeDefinitionListType(el.refTypeDefinitions); this.coreData = new CoreDataType(el.coreData); this.items = new ItemListType(el.items); this.calibrationLaboratory = new CalibrationLaboratoryType(el.calibrationLaboratory); @@ -108,6 +110,40 @@ export class AdministrativeDataType extends DCCXMLElement { } } +/* This type allows the give information about the used refTypes in a DCC. */ +export class RefTypeDefinitionListType extends DCCXMLElement { + refTypeDefinition: RefTypeDefinitionType[]; + + constructor(el: Partial<RefTypeDefinitionListType> = {}) { + super(el); + this.refTypeDefinition = ensureArray(el.refTypeDefinition).map((x) => new RefTypeDefinitionType(x)); + } +} + +/* This type contains the information about the wording of the refTypes used in a DCC. */ +export class RefTypeDefinitionType extends DCCXMLElement { + _attr: IIdAndRefTypeAttributes; + + name: TextType; + description?: RichContentType; + namespace: DCCXMLElement; + link: DCCXMLElement; + release?: DCCXMLElement; + value?: DCCXMLElement; + procedure?: DCCXMLElement; + + constructor(el: Partial<RefTypeDefinitionType> = {}) { + super(el); + this.name = new TextType(el.name); + if (el.description) this.description = new RichContentType(el.description); + this.namespace = new DCCXMLElement(el.namespace); + this.link = new DCCXMLElement(el.link); + if (el.release) this.release = new DCCXMLElement(el.release); + if (el.value) this.value = new DCCXMLElement(el.value); + if (el.procedure) this.procedure = new DCCXMLElement(el.procedure); + } +} + /** List of measurement results that are part of a DCC. */ export class MeasurementResultListType extends DCCXMLElement { measurementResult: MeasurementResultType[]; diff --git a/src/DCCDocument.ts b/src/DCCDocument.ts index 4cb72784b0ed393010cc3bce5797db201e21f1b6..04592c19544e1095b435b79489ea5c453fab3404 100644 --- a/src/DCCDocument.ts +++ b/src/DCCDocument.ts @@ -66,7 +66,7 @@ export class DCCDocument { elementNameFn: function (val, currentElementObj) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const currentElement = <any>currentElementObj; - return `${currentElement?.namespace ? `${currentElement.namespace}:` : ""}${val}`; + return `${currentElement?.ns ? `${currentElement.ns}:` : ""}${val}`; }, }); } diff --git a/src/DSI.ts b/src/DSI.ts index 0a992cc520a4d4b2d11ab4bc88b2e5f9446d9492..a17c2a65d25c56e9ab43d0a3df9507582a30f3ea 100644 --- a/src/DSI.ts +++ b/src/DSI.ts @@ -13,31 +13,31 @@ export const DSI: ISchemaInformation = { }; export class SIXMLElement extends XMLElement implements INamespaced { - get namespace() { + get ns() { return DSI.namespace; } } export class SIXMLBoolean extends XMLBoolean implements INamespaced { - get namespace() { + get ns() { return DSI.namespace; } } export class SIXMLDate extends XMLDate implements INamespaced { - get namespace() { + get ns() { return DSI.namespace; } } export class SIXMLNumber extends XMLNumber implements INamespaced { - get namespace() { + get ns() { return DSI.namespace; } } export class SIXMLList extends XMLList implements INamespaced { - get namespace() { + get ns() { return DSI.namespace; } }