isoxml
Version:
JavaScript library to parse and generate ISOXML (ISO11783-10) files
42 lines (41 loc) • 1.24 kB
JavaScript
import { TAGS } from './constants';
import { registerEntityClass } from '../classRegistry';
import { fromXML, toXML } from '../utils';
export var TimelogTimeTypeEnum;
(function (TimelogTimeTypeEnum) {
TimelogTimeTypeEnum["Effective"] = "4";
})(TimelogTimeTypeEnum || (TimelogTimeTypeEnum = {}));
const ATTRIBUTES = {
A: {
name: 'Start',
type: 'emptyString',
isPrimaryId: false,
isOptional: false,
isOnlyV4: false,
},
D: {
name: 'Type',
type: 'xs:NMTOKEN',
isPrimaryId: false,
isOptional: false,
isOnlyV4: false,
},
};
const CHILD_TAGS = {
PTN: { name: 'Position', isOnlyV4: false },
DLV: { name: 'DataLogValue', isOnlyV4: false },
};
export class TimelogTime {
constructor(attributes, isoxmlManager) {
this.attributes = attributes;
this.isoxmlManager = isoxmlManager;
this.tag = TAGS.Time;
}
static fromXML(xml, isoxmlManager, internalId, targetClass = TimelogTime) {
return fromXML(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId);
}
toXML() {
return toXML(this, ATTRIBUTES, CHILD_TAGS);
}
}
registerEntityClass('timelog', TAGS.Time, TimelogTime);