RazrFalcon / xmlparser

A low-level, pull-based, zero-allocation XML 1.0 parser.
Apache License 2.0
130 stars 16 forks source link

W3C XML Conformance Test Suite #1

Closed rushmorem closed 6 years ago

rushmorem commented 6 years ago

I noticed that the parser is parsing some invalid XML as valid. For example, incorrect nesting:

<root><child></root></child>

If it's not too much trouble, I think it would be great if it can be tested against the W3C conformance test suite.

RazrFalcon commented 6 years ago

Yes. The parser doesn't validate the tree structure. It's up to you.

I think it would be great if it can be tested against the W3C conformance test suite.

The library has about 150 tests already. Including some W3C tests.

PS: the library also doesn't validate the namespaces and doesn't check for duplicated attributes. It's basically a parser-tokenizer. Nothing more.

rushmorem commented 6 years ago

I see. Thanks for the explanation. Do you plan to have validation as part of this library, or it's something that will have to be done by a higher level one?

RazrFalcon commented 6 years ago

Currently - no. As stated in the readme, this a very low-level library. You should use it when writing a DOM-like tree. That's what I'm using it for.

The core idea of this library is that it's allocation free. And I had to allocate stuff to validate the tree structure. Like quick-xml. So if you need those check there should use another library built on top of this.

rushmorem commented 6 years ago

No problem. I really like how this library works. I'm implementing an XML based protocol. To streamline the process, I'm working on an experimental implementation of serde for XML on top of this library. I know there is serde-xml-rs but I have a few design choices I would like to explore that are not compatible with it.

RazrFalcon commented 6 years ago

I see. Also, unlike the xml-rs, this library is very fast. Usually ~10% slower that quick-xml.