Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 43x 43x 55x 55x 55x 43x 74x 74x 74x 43x 45x 43x | import { create } from 'xmlbuilder2';
import { XMLBuilder, XMLWriterOptions } from 'xmlbuilder2/lib/interfaces';
/**
* @export
* @class Verb
* Base class for all BXML verbs
*/
export class Verb {
name: string;
content: string | undefined;
attributes: object | undefined;
/**
* Creates an instance of Verb
* @param name [string] Name of the XML element
* @param content [string] Content of the XML element
* @param attributes [object] Attributes of the XML element
*/
constructor(name: string, content?: string, attributes?: object) {
this.name = name;
this.content = content;
this.attributes = attributes;
}
/**
* Generate an XML element for the verb
*/
generateXml(): XMLBuilder {
const xml = create().ele(this.name, this.attributes);
if (this.content) { xml.txt(this.content); }
return xml;
}
/**
* Return BXML representation of this element
* @param options XML Serialization options
*/
toBxml(options?: XMLWriterOptions): string {
return this.generateXml().toString(options);
}
}
|