Browse Source

fix nodeset xml params

Martin Kunz 1 month ago
parent
commit
9b4d2452c1
2 changed files with 10 additions and 9 deletions
  1. 3 3
      src/ua/Model.ts
  2. 7 6
      src/ua/UANodeSet.ts

+ 3 - 3
src/ua/Model.ts

@@ -1,6 +1,6 @@
 import { XMLElem, type IToXML } from "@/util/XmlElem";
 
-export class Model implements IToXML{
+export class UAModel implements IToXML{
     constructor(public modelUri: string,
                 public publicationDate: string,
                 public version: string,
@@ -17,7 +17,7 @@ export class Model implements IToXML{
                 .attr('PublicationDate', this.publicationDate)
     }
 
-    static fromXML(xmlObject: any): Model{
-        return new Model(xmlObject['@_ModelUri'], xmlObject['@_PublicationDate'], xmlObject['@_Version'], xmlObject['@_XmlSchemaUri']);
+    static fromXML(xmlObject: any): UAModel{
+        return new UAModel(xmlObject['@_ModelUri'], xmlObject['@_PublicationDate'], xmlObject['@_Version'], xmlObject['@_XmlSchemaUri']);
     }
 }

+ 7 - 6
src/ua/UANodeSet.ts

@@ -4,7 +4,7 @@ import type { UABaseNode } from './UABaseNode';
 import { UAVariable } from './UAVariable';
 import { UAMethod } from './UAMethod';
 import { NamespaceTable } from './NameSpaceTable';
-import { Model } from './Model';
+import { UAModel } from './UAModel';
 import { XMLElem, type IToXML } from '@/util/XmlElem';
 import { UAReferenceType } from './UAReferenceType';
 import { UAObjectType } from './UAObjectType';
@@ -16,14 +16,15 @@ import { UAAlias } from './UAAlias';
 export class UANodeSet implements IToXML{
 
     constructor(public fileName: string,
-                public models: Model[],
+                public models: UAModel[],
                 public aliases: UAAlias[],
                 public nodes: UABaseNode[],
                 public nameSpaceTable: NamespaceTable,
+                public xmlns: string,
                 public xmlns_xsi: string,
                 public xmlns_xsd: string,
                 public lastModified: string,
-                public xmlns: string) {
+                ) {
     }
 
     reIndex(nst: NamespaceTable) {
@@ -132,10 +133,10 @@ export class UANodeSet implements IToXML{
         for(const xmlAlias of xmlAliases.Alias) {
             aliases.push(UAAlias.fromXML(xmlAlias));
         }
-        const models: Model[]=[];
+        const models: UAModel[]=[];
         const xmlModels=xmlObj['UANodeSet']['Models']||[];
         for(const xmlModel of xmlModels.Model) {
-            models.push(Model.fromXML(xmlModel));
+            models.push(UAModel.fromXML(xmlModel));
         }
         const nodes:UABaseNode[]=[];
         const xmlObjects=xmlObj['UANodeSet']['UAObject']||[];
@@ -168,6 +169,6 @@ export class UANodeSet implements IToXML{
             nst.addUri(nsUri['#text'])
         }
 
-        return new UANodeSet(fileName, models, aliases, nodes, nst, xmlObj['UANodeSet']['@_xmlns'], xmlObj['UANodeSet']['@_xmlns:xsd'], xmlObj['UANodeSet']['@_xmlns:xsi'], xmlObj['UANodeSet']['@_LastModified']);
+        return new UANodeSet(fileName, models, aliases, nodes, nst, xmlObj['UANodeSet']['@_xmlns'], xmlObj['UANodeSet']['@_xmlns:xsi'], xmlObj['UANodeSet']['@_xmlns:xsd'], xmlObj['UANodeSet']['@_LastModified']);
     }
 }