Commit 6fe4b5c4 authored by Stephan Kreutzer's avatar Stephan Kreutzer

Example improved.

parent f6d4e457
......@@ -6,7 +6,7 @@
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8"/>
<!--
Copyright (C) 2018 Stephan Kreutzer
Copyright (C) 2018-2019 Stephan Kreutzer
This file is part of JsStAX.
......@@ -76,7 +76,15 @@
tag += attributeName.getLocalPart();
tag += "=\"";
tag += attributes[key].getValue().replace("\"", "&quot;");
let attributeValue = attributes[key].getValue();
// '&' needs to come first.
attributeValue = attributeValue.replace(/&/g, "&amp;");
attributeValue = attributeValue.replace(/</g, "&lt;");
attributeValue = attributeValue.replace(/>/g, "&gt;");
attributeValue = attributeValue.replace(/"/g, "&quot;");
tag += attributeValue;
tag += "\"";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment