Simplify run format properties, removing duplicate classes. Add values functions, which check and clean up values for specific defined types from the schema
This commit is contained in:
@ -4,4 +4,5 @@ export * from "./default-attributes";
|
||||
export * from "./imported-xml-component";
|
||||
export * from "./xmlable-object";
|
||||
export * from "./initializable-xml-component";
|
||||
export * from "./simple-elements";
|
||||
export * from "./base";
|
||||
|
27
src/file/xml-components/simple-elements.ts
Normal file
27
src/file/xml-components/simple-elements.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import { Attributes, XmlComponent } from "file/xml-components";
|
||||
|
||||
import { hpsMeasureValue } from "../values";
|
||||
|
||||
// This represents element type CT_OnOff, which indicate a boolean value.
|
||||
//
|
||||
// <xsd:complexType name="CT_OnOff">
|
||||
// <xsd:attribute name="val" type="s:ST_OnOff"/>
|
||||
// </xsd:complexType>
|
||||
export class OnOffElement extends XmlComponent {
|
||||
constructor(name: string, val: boolean | undefined = true) {
|
||||
super(name);
|
||||
this.root.push(new Attributes({ val }));
|
||||
}
|
||||
}
|
||||
|
||||
// This represents element type CT_HpsMeasure, which indicate an unsigned int or a measurement with unit.
|
||||
//
|
||||
// <xsd:complexType name="CT_HpsMeasure">
|
||||
// <xsd:attribute name="val" type="ST_HpsMeasure" use="required"/>
|
||||
// </xsd:complexType>
|
||||
export class HpsMeasureElement extends XmlComponent {
|
||||
constructor(name: string, val: number | string) {
|
||||
super(name);
|
||||
this.root.push(new Attributes({ val: hpsMeasureValue(val) }));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user