UNPKG

isoxml

Version:

JavaScript library to parse and generate ISOXML (ISO11783-10) files

49 lines (48 loc) 1.31 kB
import { TAGS } from './constants'; import { registerEntityClass } from '../classRegistry'; import { fromXML, toXML } from '../utils'; const ATTRIBUTES = { A: { name: 'DeviceIdRef_0', type: 'xs:IDREF', isPrimaryId: false, isOptional: false, isOnlyV4: false, }, B: { name: 'DeviceElementIdRef_0', type: 'xs:IDREF', isPrimaryId: false, isOptional: false, isOnlyV4: false, }, C: { name: 'DeviceIdRef_1', type: 'xs:IDREF', isPrimaryId: false, isOptional: false, isOnlyV4: false, }, D: { name: 'DeviceElementIdRef_1', type: 'xs:IDREF', isPrimaryId: false, isOptional: false, isOnlyV4: false, }, }; const CHILD_TAGS = {}; export class Connection { constructor(attributes, isoxmlManager) { this.attributes = attributes; this.isoxmlManager = isoxmlManager; this.tag = TAGS.Connection; } static fromXML(xml, isoxmlManager, internalId, targetClass = Connection) { return fromXML(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId); } toXML() { return toXML(this, ATTRIBUTES, CHILD_TAGS); } } registerEntityClass('main', TAGS.Connection, Connection);