Skip to content

unable to load ESI files from regular constructors like Omron #1

Open
@jimy-byerley

Description

@jimy-byerley

Hello dear maintainers

I'm trying to learn to use crate ethercat, but having an issue with the ESI XML files
I'm trying to run ethercat/examples/cyclic-data.rs but the XML parsing fails with my ESI files
I tried the following files: xml.zip

  • omron 1S, ESI file
  • tinsmith erob, ESI file

both work well on the sysmac-studio software, so I doubt there is something wrong about the files themselves. They both give the same parser errors when loaded by ethercat-esi

$ target/debug/examples/cyclic-data ~/omron-1s.xml
Error: Custom { kind: Other, error: "Syntax: 1:1 Unexpected characters outside the root element: \u{feff}" }
$ target/debug/examples/cyclic-data ~/tinsmith-erob.xml
Error: Custom { kind: Other, error: "Syntax: 1:1 Unexpected characters outside the root element: \u{feff}" }

\u{feff} is a character that marks the file as utf-8, so it should be considered as whitespace. I added it to is_whitespace_char() in xml-rs

Then I fall into a new error

$ target/debug/examples/cyclic-data ~/omron-1s.xml
Error: Custom { kind: Other, error: "custom: duplicate field `Name`" }

It seems that ethercat-esi doesn't handle locale variants in xml files, so I removed the duplicates and run again to get the following error

$ target/debug/examples/cyclic-data ~/omron-1s.xml
Error: Custom { kind: Other, error: "custom: missing field `Vendor`" }
$ target/debug/examples/cyclic-data ~/tinsmith-erob.xml
Error: Custom { kind: Other, error: "custom: missing field `Sm`" }

The fields mentionned are not missing in the xml files, so I don't know what is wrong.
I tried to fix ethercat-esi by switching it from serde-xml-rs to quick-xml, but it gave me the same kind of error as the latest ones, as we can see on this issue

Is there a way to fix all these issues from ethercat-esi (especially the missing fields) ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions