progval / rust-xml-schema

[WIP] (Self-generating) XML parser generator based on XML schemas.
GNU Affero General Public License v3.0
28 stars 3 forks source link

Unable to parse the IEC 61131-10 Spec #4

Closed Michael-F-Bryan closed 4 years ago

Michael-F-Bryan commented 4 years ago

I recently tried to use this against the IEC 61131 XSD spec (it's the file format used by most PLCs) and it complained about expecting the end of xsd:schema but finding the start of a xsd:complexType.

I'm guessing it's not able to handle multiple top-level items inside xsd:schema?

$ cargo run --package xml-schema --bin gen .\iec61131-10.xsd > schema.rs
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
     Running `target\debug\gen.exe .\iec61131-10.xsd`
thread 'main' panicked at 'Expected closing tag for xsd:schema, got Some(ElementStart(StrSpan("xsd" 12282..12285), StrSpan("complexType" 12286..12297)))', xml-schema\src\parser.rs:854:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: process didn't exit successfully: `target\debug\gen.exe .\iec61131-10.xsd` (exit code: 101)
progval commented 4 years ago

Minimal example to reproduce:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
  <xsd:complexType name="TypeSpecBase"/>
</xsd:schema>

That's embarrassing...

progval commented 4 years ago

This should now be fixed in master. There is another error on your document, but it happens after the parser step now. It's caused by references to its own namespace, which unfortunately isn't supported yet (I know, it's a shame). And I have to do a major refactoring of the code-generator for it to be supported, so it may take some time