xml.test.ts 495 B

12345678910111213
  1. import { test } from 'vitest'
  2. import { AddressSpace } from './ua/AddressSpace'
  3. import { UANodeSet } from './ua/UANodeSet';
  4. import * as fs from 'fs';
  5. test('xml', () => {
  6. const as=new AddressSpace([]);
  7. const data = fs.readFileSync('public/nodesets/Opc.Ua.NodeSet2.xml', 'utf8');
  8. const nodeset= UANodeSet.parse(data,"NodeSet2",as);
  9. as.addNodeset(nodeset);
  10. const xmlElem=nodeset.toXML(nodeset.nameSpaceTable, as.nst);
  11. fs.writeFileSync("nodeset2.xml", xmlElem.toString());
  12. })