我尝试使用NetSuite Suitelet中的UPS Rating API。当我使用 nlapiRequestURL 执行此操作时,我收到错误" XML声明格式不正确"来自UPS。我一直在盯着这个XML,我无法找到我做错的事情。有没有人有想法? 为什么我的XML格式不正确?
export default `<html>
<head></head>
<body>
<h1 id='toto'>TATA</h1>
<br />
<div id="sketch">
<canvas id="paint" style='border: 1px solid black'></canvas>
</div>
<script>
(function() {
var canvas = document.querySelector('#paint');
var ctx = canvas.getContext('2d');
var sketch = document.querySelector('#sketch');
var sketch_style = getComputedStyle(sketch);
canvas.width = parseInt(sketch_style.getPropertyValue('width'));
canvas.height = parseInt(sketch_style.getPropertyValue('height'));
var mouse = {x: 0, y: 0};
var start_events = ["mousedown", "touchstart"];
var move_events = ["mousemove", "touchmove"];
var end_events = ["mouseup", "touchend"];
/* Mouse Capturing Work */
move_events.forEach(function(event) {
canvas.addEventListener(event, function(e) {
mouse.x = e.pageX - this.offsetLeft;
mouse.y = e.pageY - this.offsetTop;
}, false);
});
/* Drawing on Paint App */
ctx.lineWidth = 5;
ctx.lineJoin = 'round';
ctx.lineCap = 'round';
ctx.strokeStyle = 'back';
start_events.forEach(function(event) {
canvas.addEventListener(event, function(e) {
ctx.beginPath();
ctx.moveTo(mouse.x, mouse.y);
move_events.forEach(function(me){ canvas.addEventListener(me, onPaint, false); });
}, false);
});
end_events.forEach(function(event) {
canvas.addEventListener(event, function(e) {
move_events.forEach(function(me){ canvas.removeEventListener(me, onPaint, false); });
}, false);
});
var onPaint = function() {
ctx.lineTo(mouse.x, mouse.y);
ctx.stroke();
};
}());
</script>
</body>
</html>`;
答案 0 :(得分:4)
我复制并粘贴在这里,&#34; xmllint&#34;我删除后通过它很好 XML声明之前的空格。你在那里有空间,或者只是将它粘贴到SO中的工件?
-s