tafia / quick-xml

Rust high performance xml reader and writer
MIT License
1.18k stars 235 forks source link

Add conformance tests #749

Open Mingun opened 4 months ago

Mingun commented 4 months ago

The official test suite is located at https://www.w3.org/XML/Test/. The all links from that page or found by references from that page:

There also exist W3C XML Schema 1.1 (XSD 1.1) test suite, maybe would be useful: https://github.com/w3c/xsdtests

The preferred implementation should automatically download test suite if it does not exist locally and run tests. We also could have a copy as a submodule in our repository. I prefer to use default Rust tools, i.e. cargo test. Test could be implemented in a separated crate to not slow down everyday workflow.

Mingun commented 4 months ago

Some intermediate results of investigation:

  1. The official conformance testsuite has very low quality: many repeated tests, weak structure, has errors (file with "pass" in name marked as "invalid", but comment say that it is valid)
  2. Found bug in quick-xml (#753): we end processing instruction after the first > even if there is no ? before it. Actually, we produce an error in that case. We should continue search of ?> until EOF is reached.
  3. Processing instructions:
    • continued to the first ?> which cannot be escaped
    • any parameter entities (%name;) or general entities (&name;) are not recognized
    • character references (&#...;) are not recognized
    • no characters has special meaning. In particular, ' and " does nothing and no need to be paired
    • literal characters restricted in XML still forbidden. So you can write � (which is just string "�"), but cannot use character U+0000