|
@@ -11,13 +11,19 @@ import { UAObjectType } from './UAObjectType';
|
|
import { UAVariableType } from './UAVariableType';
|
|
import { UAVariableType } from './UAVariableType';
|
|
import type { AddressSpace } from './AddressSpace';
|
|
import type { AddressSpace } from './AddressSpace';
|
|
import type { IAddressSpace } from './IAddressSpace';
|
|
import type { IAddressSpace } from './IAddressSpace';
|
|
|
|
+import { UAAlias } from './UAAlias';
|
|
|
|
|
|
export class UANodeSet implements IToXML{
|
|
export class UANodeSet implements IToXML{
|
|
|
|
|
|
constructor(public fileName: string,
|
|
constructor(public fileName: string,
|
|
public models: Model[],
|
|
public models: Model[],
|
|
|
|
+ public aliases: UAAlias[],
|
|
public nodes: UABaseNode[],
|
|
public nodes: UABaseNode[],
|
|
- public nameSpaceTable: NamespaceTable) {
|
|
|
|
|
|
+ public nameSpaceTable: NamespaceTable,
|
|
|
|
+ public xmlns_xsi: string,
|
|
|
|
+ public xmlns_xsd: string,
|
|
|
|
+ public lastModified: string,
|
|
|
|
+ public xmlns: string) {
|
|
}
|
|
}
|
|
|
|
|
|
reIndex(nst: NamespaceTable) {
|
|
reIndex(nst: NamespaceTable) {
|
|
@@ -38,17 +44,24 @@ export class UANodeSet implements IToXML{
|
|
|
|
|
|
toXML(lnst: NamespaceTable, gnst: NamespaceTable): XMLElem {
|
|
toXML(lnst: NamespaceTable, gnst: NamespaceTable): XMLElem {
|
|
const xmlUANodeSet =new XMLElem('UANodeSet');
|
|
const xmlUANodeSet =new XMLElem('UANodeSet');
|
|
|
|
+ xmlUANodeSet.attr('xmlns:xsi', this.xmlns_xsi);
|
|
|
|
+ xmlUANodeSet.attr('xmlns:xsd', this.xmlns_xsd);
|
|
|
|
+ xmlUANodeSet.attr('xmlns', this.xmlns);
|
|
|
|
+ xmlUANodeSet.attr('LastModified', this.lastModified);
|
|
const xmlNameSpaceUris=xmlUANodeSet.add(new XMLElem('NamespaceUris'));
|
|
const xmlNameSpaceUris=xmlUANodeSet.add(new XMLElem('NamespaceUris'));
|
|
|
|
|
|
- for(let i=0;i<this.nameSpaceTable.nsMap.size(); i++) {
|
|
|
|
|
|
+ for(let i=1;i<this.nameSpaceTable.nsMap.size(); i++) { //skip UA(0) ns
|
|
const uri=this.nameSpaceTable.nsMap.get(i);
|
|
const uri=this.nameSpaceTable.nsMap.get(i);
|
|
xmlNameSpaceUris.elem("Uri", uri);
|
|
xmlNameSpaceUris.elem("Uri", uri);
|
|
}
|
|
}
|
|
-
|
|
|
|
const xmlModels=xmlUANodeSet.add(new XMLElem('Models'));
|
|
const xmlModels=xmlUANodeSet.add(new XMLElem('Models'));
|
|
for(const model of this.models) {
|
|
for(const model of this.models) {
|
|
xmlModels.add(model.toXML())
|
|
xmlModels.add(model.toXML())
|
|
}
|
|
}
|
|
|
|
+ const xmlAliases=xmlUANodeSet.add(new XMLElem('Aliases'));
|
|
|
|
+ for(const alias of this.aliases) {
|
|
|
|
+ xmlAliases.add(alias.toXML())
|
|
|
|
+ }
|
|
for(const node of this.nodes) {
|
|
for(const node of this.nodes) {
|
|
xmlUANodeSet.add(node.toXML(lnst, gnst))
|
|
xmlUANodeSet.add(node.toXML(lnst, gnst))
|
|
}
|
|
}
|
|
@@ -90,6 +103,11 @@ export class UANodeSet implements IToXML{
|
|
}
|
|
}
|
|
const parser = new XMLParser(parseOptions);
|
|
const parser = new XMLParser(parseOptions);
|
|
const xmlObj = parser.parse(xml);
|
|
const xmlObj = parser.parse(xml);
|
|
|
|
+ const xmlAliases=xmlObj['UANodeSet']['Aliases']||[];
|
|
|
|
+ const aliases: UAAlias[]=[];
|
|
|
|
+ for(const xmlAlias of xmlAliases.Alias) {
|
|
|
|
+ aliases.push(UAAlias.fromXML(xmlAlias));
|
|
|
|
+ }
|
|
const models: Model[]=[];
|
|
const models: Model[]=[];
|
|
const xmlModels=xmlObj['UANodeSet']['Models']||[];
|
|
const xmlModels=xmlObj['UANodeSet']['Models']||[];
|
|
for(const xmlModel of xmlModels.Model) {
|
|
for(const xmlModel of xmlModels.Model) {
|
|
@@ -125,6 +143,7 @@ export class UANodeSet implements IToXML{
|
|
for(const nsUri of uaNamespaceUris['Uri']||[]) {
|
|
for(const nsUri of uaNamespaceUris['Uri']||[]) {
|
|
nst.addUri(nsUri['#text'])
|
|
nst.addUri(nsUri['#text'])
|
|
}
|
|
}
|
|
- return new UANodeSet(fileName, models, nodes, nst);
|
|
|
|
|
|
+
|
|
|
|
+ return new UANodeSet(fileName, models, aliases, nodes, nst, xmlObj['UANodeSet']['@_xmlns'], xmlObj['UANodeSet']['@_xmlns:xsd'], xmlObj['UANodeSet']['@_xmlns:xsi'], xmlObj['UANodeSet']['@_LastModified']);
|
|
}
|
|
}
|
|
}
|
|
}
|