Skip to content

Commit

Permalink
Merge f16a40a into 152ea0f
Browse files Browse the repository at this point in the history
  • Loading branch information
erossignon committed Sep 15, 2020
2 parents 152ea0f + f16a40a commit 601e8b4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,8 @@ function _dumpVariantValue(xw: XmlWriter, dataType: DataType, value: any) {
if (value !== undefined && value !== null) {
xw.startElement(DataType[dataType]);
// xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2008/02/Types.xsd");
xw.text(
value
.toString("base64")
.match(/.{1,80}/g)
.join("\n")
);
const base64 = value.toString("base64");
xw.text(base64.match(/.{0,80}/g).join("\n"));
xw.endElement();
}
break;
Expand Down
22 changes: 22 additions & 0 deletions packages/node-opcua-address-space/test/test_nodeset_to_xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,4 +673,26 @@ describe("nodeset2.xml with more than one referenced namespace", function (this:

// console.log(xml);
});

it("NSXML4 - empty buffer #861 ", async () => {
const v = namespace.addVariable({
browseName: "TestVariable",
dataType: DataType.ByteString,
organizedBy: addressSpace.rootFolder.objects,
value: {
dataType: DataType.ByteString,
value: Buffer.alloc(0),
},
});

const xml = namespace.toNodeset2XML();
const xml2 = xml.replace(/LastModified="([^"]*)"/g, 'LastModified="YYYY-MM-DD"');
const tmpFilename = getTempFilename("__generated_node_set_version_x.xml");
fs.writeFileSync(tmpFilename, xml);

const r_xml2 = await reloadedNodeSet(tmpFilename);
r_xml2.split("\n").should.eql(xml2.split("\n"));

// console.log(xml);
});
});

0 comments on commit 601e8b4

Please sign in to comment.