Git Product home page Git Product logo

Comments (3)

rgrove avatar rgrove commented on July 24, 2024

Nice job! I'm happy to have run across this.

Thanks!

I see some of your conformance test exceptions (e.g. not-wf-sa-173) say "claims to test an illegal char, but tests the wrong char". How are these the wrong character?

Good catch. It looks like not-wf-sa-173 may have been skipped by mistake, since it does in fact appear to test the correct char.

not-wf-sa-168 is an example of a test case whose description claims that it tests the presence of an unpaired surrogate, D800, but D800 doesn't actually appear in the test case. I'm not sure exactly why this is, but I suspect some of the test cases (which I downloaded directly from https://www.w3.org/XML/Test/xmlconf-20020606.htm) may have encoding issues. Either that or I'm missing something?

from parse-xml.

bodawei avatar bodawei commented on July 24, 2024

Good catch.

Actually, just a random catch. I just happened to poke there.

not-wf-sa-168

This is a weird one. The file is utf8 and has 0xed 0xa0 0x80 in it which is actually 0xD800 in utf8 ( https://www.compart.com/en/unicode/U+D800 ) So, I think that's the right thing?

from parse-xml.

rgrove avatar rgrove commented on July 24, 2024

Ah, I think I see what's happening. When the test case is read by fs.readFile(), 0xED, 0xA0, and 0x80 each become U+FFFD because Node's Buffer#toString() refuses to produce an invalid UTF-8 string. Since U+FFFD is valid in an XML document, parsing succeeds when the test expects it to fail.

When I manually construct an XML doc in the Node.js REPL containing U+D800 and try to parse it, parseXml fails as it should:

> parseXml('<doc>\uD800</doc>')
Uncaught Error: Invalid character (line 1, column 6)
  <doc>�</doc>

I'm not sure if there's a good way to read this test file and feed it to parseXml while preserving the invalid byte sequence, but I suppose I could convert it to a manual test. Will give this some thought.

from parse-xml.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.