UNPKG

isoxml

Version:

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

37 lines (36 loc) 1.07 kB
import { TAGS } from './constants'; import { registerEntityClass } from '../classRegistry'; import { fromXML, toXML } from '../utils'; const ATTRIBUTES = { A: { name: 'ProductIdRef', type: 'xs:IDREF', isPrimaryId: false, isOptional: false, isOnlyV4: undefined, }, B: { name: 'QuantityValue', type: 'xs:long', isPrimaryId: false, isOptional: false, isOnlyV4: undefined, minValue: 0, maxValue: 2147483647, }, }; const CHILD_TAGS = {}; export class ProductRelation { constructor(attributes, isoxmlManager) { this.attributes = attributes; this.isoxmlManager = isoxmlManager; this.tag = TAGS.ProductRelation; } static fromXML(xml, isoxmlManager, internalId, targetClass = ProductRelation) { return fromXML(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId); } toXML() { return toXML(this, ATTRIBUTES, CHILD_TAGS); } } registerEntityClass('main', TAGS.ProductRelation, ProductRelation);