UNPKG

isoxml

Version:

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

37 lines (36 loc) 1.61 kB
import { TAGS } from './constants'; import { registerEntityClass } from '../classRegistry'; import { fromXML, toXML } from '../utils'; const ATTRIBUTES = {}; const CHILD_TAGS = { BSN: { name: 'BaseStation', isOnlyV4: undefined }, CCT: { name: 'CodedComment', isOnlyV4: undefined }, CCG: { name: 'CodedCommentGroup', isOnlyV4: undefined }, CLD: { name: 'ColourLegend', isOnlyV4: undefined }, CTP: { name: 'CropType', isOnlyV4: undefined }, CPC: { name: 'CulturalPractice', isOnlyV4: undefined }, CTR: { name: 'Customer', isOnlyV4: undefined }, DVC: { name: 'Device', isOnlyV4: undefined }, FRM: { name: 'Farm', isOnlyV4: undefined }, OTQ: { name: 'OperationTechnique', isOnlyV4: undefined }, PFD: { name: 'Partfield', isOnlyV4: undefined }, PDT: { name: 'Product', isOnlyV4: undefined }, PGP: { name: 'ProductGroup', isOnlyV4: undefined }, TSK: { name: 'Task', isOnlyV4: undefined }, VPN: { name: 'ValuePresentation', isOnlyV4: undefined }, WKR: { name: 'Worker', isOnlyV4: undefined }, }; export class ExternalFileContents { constructor(attributes, isoxmlManager) { this.attributes = attributes; this.isoxmlManager = isoxmlManager; this.tag = TAGS.ExternalFileContents; } static fromXML(xml, isoxmlManager, internalId, targetClass = ExternalFileContents) { return fromXML(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId); } toXML() { return toXML(this, ATTRIBUTES, CHILD_TAGS); } } registerEntityClass('main', TAGS.ExternalFileContents, ExternalFileContents);