Browse Source

enable fxp alwaysCreateTextNode, to ensure consistent results

Martin Kunz 1 year ago
parent
commit
cb7ee9a24a
4 changed files with 7 additions and 10 deletions
  1. 1 1
      src/components/TreeItem.vue
  2. 1 1
      src/ua/AddressSpace.ts
  3. 1 1
      src/ua/UABaseNode.ts
  4. 4 7
      src/ua/UANodeSet.ts

+ 1 - 1
src/components/TreeItem.vue

@@ -11,7 +11,7 @@ const props = defineProps({
 const isOpen = ref(false)
 const isFolder = computed(() => {
   const children=props.model?.getChildren();
-  return children &&children.length;
+  return children && children.length;
 })
 
 function toggle() {

+ 1 - 1
src/ua/AddressSpace.ts

@@ -27,7 +27,7 @@ export class AddressSpace{
         for(const node of nodeset.nodes) {
             this.nodeMap.set(node.nodeId.toString(), node);
         }
-        nodeset.resolveChildren(this.nodeMap);
+        nodeset.resolveReferences(this.nodeMap);
         this.nodesets.push(nodeset);
     }
 

+ 1 - 1
src/ua/UABaseNode.ts

@@ -71,7 +71,7 @@ export class UABaseNode implements IToXML{
         for(const xmlref of xmlReferences.Reference) {
             references.push(UAReference.fromXML(xmlref, nodeId));
         }
-        const ua=new UABaseNode(nodeId, xmlObject['@_BrowseName'], xmlObject['DisplayName'], references);
+        const ua=new UABaseNode(nodeId, xmlObject['@_BrowseName'], xmlObject['DisplayName']['#text'], references);
         return ua;
     }
 

+ 4 - 7
src/ua/UANodeSet.ts

@@ -24,7 +24,7 @@ export class UANodeSet implements IToXML{
         }
     }
 
-    resolveChildren(nm: Map<string, UABaseNode>) {
+    resolveReferences(nm: Map<string, UABaseNode>) {
         for(const node of this.nodes) {
             node.resolveReferences(nm);
         }    
@@ -50,11 +50,8 @@ export class UANodeSet implements IToXML{
     static async parse(xml: string, fileName: string): Promise<UANodeSet> {
         const parseOptions:Partial<X2jOptions>={
             ignoreAttributes: false,
-            numberParseOptions: {
-                hex: false,
-                leadingZeros: false,
-                skipLike: /./ //disable number detection. Otherwise string values might end up as numbers.
-            },
+            alwaysCreateTextNode: true, //force consistent result
+            parseTagValue:false, //disable number detection. Otherwise string values might end up as numbers.
             // eslint-disable-next-line @typescript-eslint/no-unused-vars
             isArray: (name, jpath, isLeafNode, isAttribute):boolean => { 
                 switch(jpath) {
@@ -90,7 +87,7 @@ export class UANodeSet implements IToXML{
         const nst=new NamespaceTable();
         if(uaNamespaceUris) {
             for(const nsUri of uaNamespaceUris['Uri']) {
-                nst.addUri(nsUri)
+                nst.addUri(nsUri['#text'])
             }
         }
         return new UANodeSet(fileName, models, nodes, nst);