-
Notifications
You must be signed in to change notification settings - Fork 14
XML --> JSON --> XML with < or > in attribute value #6
Copy link
Copy link
Open
Description
My XML attribute contains < and >. If I send it round trip (XML --> JSON --> XML), should the final XML match the initial XML?
Code snippet:
const fromXML = require("from-xml").fromXML;
const toXML = require("to-xml").toXML;
const data = fromXML('<object label="<a href="https://www.ncbi.nlm.nih.gov/gene/59272">ACE2</a>" dataSource="ncbigene" identifier="59272" id="TjQ1G5W0H9Vnf-2-B7EA-1"> <mxCell style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxGeometry x="80" y="110" width="120" height="60" as="geometry" /> </mxCell> </object>');
console.log(JSON.stringify(data));
const xml = toXML(data);
console.log(xml);Initial XML attribute: label="<a href="https://www.ncbi.nlm.nih.gov/gene/59272">ACE2</a>"
Final XML attribute: label="<a href="https://www.ncbi.nlm.nih.gov/gene/59272">ACE2</a>"
< and > are changed after a round-trip conversion, but " is not changed.
Thanks!
(This XML comes from the drawing tool at diagrams.net.)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels