Skip to content
Snippets Groups Projects
Verified Commit d16dc30b authored by Jan Loewe's avatar Jan Loewe :speech_balloon:
Browse files

feat(dcc): improve namespace handling

parent 917abac2
No related branches found
No related tags found
No related merge requests found
export interface INamespaced {
get namespace(): string;
}
export interface ISchemaInformation {
schemaVersion: string;
namespaceUrl: string;
namespace: string;
schemaLocation: string;
}
import { XMLElement } from "./XMLElement";
export class XMLBoolean extends XMLElement {
constructor(options: XMLBoolean) {
super(options);
constructor(element?: Partial<XMLBoolean>) {
super(element);
}
get value() {
......
import { XMLElement } from "./XMLElement";
export class XMLDate extends XMLElement {
constructor(options?: XMLDate) {
super(options);
constructor(element?: Partial<XMLDate>) {
super(element);
}
get value() {
......
......@@ -13,7 +13,7 @@ export class XMLElement {
_text?: string;
_attr?: AttributeType;
constructor(element?: XMLElement) {
constructor(element?: Partial<XMLElement>) {
this._text = (element && element._text) || "";
this._attr = (element && element._attr) || {};
}
......
import { XMLElement } from "./XMLElement";
export class XMLList extends XMLElement {
constructor(options?: XMLList) {
super(options);
constructor(element?: Partial<XMLList>) {
super(element);
}
get values() {
......
import { XMLElement } from "./XMLElement";
export class XMLNumber extends XMLElement {
constructor(options?: XMLNumber) {
super(options);
constructor(element?: Partial<XMLNumber>) {
super(element);
}
get value() {
......
......@@ -3,3 +3,5 @@ export * from "./XMLDate";
export * from "./XMLElement";
export * from "./XMLList";
export * from "./XMLNumber";
export * from "./INamespaced";
export * from "./ISchemaInformation";
This diff is collapsed.
......@@ -40,7 +40,7 @@ export class DCCDocument {
elementNameFn: function (val, currentElementObj) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const currentElement = <any>currentElementObj;
return `${typeof currentElement?.getNamespace === "function" ? currentElement.getNamespace() : ""}:${val}`;
return `${currentElement?.namespace ? `${currentElement.namespace}:` : ""}${val}`;
},
});
}
......
This diff is collapsed.
export * from "./Util";
export * from "./DCCDocument";
export * from "./DCC";
export * as SI from "./SI";
export * from "./DSI";
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment