1

When creating a custom plot I came across that Firefox's "Web Console" flagged an error with:

XML Parsing Error: not well-formed Location: http://192.168.1.201/testdata.dat Line Number 1, Column 5:

The html code and the content of testdata.dat are below.

Although it says error, the page actually works as expected, but I kind of wasn't satisfied and played around a bit. I found that if I rename testdata.dat to testdata.csv and adjust the html file accordingly, the error goes away.

Is this expected? Can someone shine a light on this?

dygraphs_test.html:

<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/dygraph/2.1.0/dygraph.min.js"></script>
<link rel="stylesheet" src="//cdnjs.cloudflare.com/ajax/libs/dygraph/2.1.0/dygraph.min.css" />
</head>
<body>
    <h3>Test</h3>
<div id="graphdiv2"></div>
<script type="text/javascript">
  g2 = new Dygraph(
    document.getElementById("graphdiv2"),
    "testdata.dat",
    {
      labels: [ "Date", "Temperature", "Col3", "Col4", "Col5" ],
    } // options
  );
</script>
</body>
</html>

testdata.dat:

2018/01/12 17:59:04,22.18,22.34,28.44,20.31
2018/01/12 17:59:06,22.19,22.68,28.44,20.14
2018/01/12 17:59:08,22.18,22.32,28.44,20.31
2018/01/12 17:59:10,22.18,22.35,28.38,20.31
2018/01/12 17:59:12,22.18,22.37,28.38,20.31
2018/01/12 17:59:14,22.18,22.39,28.44,20.31
3
  • You have comma separated values (CSV), not an XML document, which puts data in a different syntax Commented Jan 14, 2018 at 0:45
  • Dygraphs does exactly the same in their front page example. On dygraphs.com they use "ny-vs-sf.txt" as the filename that holds the csv data. The syntax for dygraphs.com/data.html#url for the data source does not mention that the link is parsed according to the file ending, and nowhere does it say XML. Commented Jan 14, 2018 at 0:56
  • Looks like I can't re-vote to close, but this is a duplicate: stackoverflow.com/questions/42630246/… Commented Jan 14, 2018 at 1:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.