Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error importing VTU with <AppendedData encoding="raw"> block #27

Open
w1th0utnam3 opened this issue Apr 19, 2023 · 6 comments
Open

Error importing VTU with <AppendedData encoding="raw"> block #27

w1th0utnam3 opened this issue Apr 19, 2023 · 6 comments

Comments

@w1th0utnam3
Copy link
Contributor

w1th0utnam3 commented Apr 19, 2023

The attached file fluid_1_91.vtu cannot be loaded using v0.6.0 or the release-0.7 branch and results in the errors:

XML error: Deserialization error: Xml(UnexpectedEof("</Err(Utf8Error { valid_up_to: 0, error_len: Some(1) })>"))
Deserialization error: Xml(UnexpectedEof("</Err(Utf8Error { valid_up_to: 0, error_len: Some(1) })>"))
Unexpected EOF during reading </Err(Utf8Error { valid_up_to: 0, error_len: Some(1) })>.
Unexpected EOF during reading </Err(Utf8Error { valid_up_to: 0, error_len: Some(1) })>.

while Paraview is able to load the file.

The file uses a <AppendedData encoding="raw">...</AppendedData> raw binary block for all the data arrays and I suspect it happens to contain characters or sequences that confuse the XML parser.

The file fluid_1_91_encoded.vtu can be read without problems after opening the original file in Paraview and re-exporting it to VTU with the option "Encode appended data" which I guess applies base64 encoding.

I don't know if it is possible to somehow use different options for the XML parser to support the raw binary block or whether this is actually not allowed by the XML format and would require manual parsing.

fluid_1_91.zip

@elrnv
Copy link
Owner

elrnv commented Apr 19, 2023

Thank you for this issue! Indeed officially the XML format doesn't support binary data, and this is actually what is blocking the 0.7 release currently. The plan is to upstream a feature into quick-xml that allows one to implement a custom parser for the text in XML files. The example file you provided should be very helpful in addressing testing binary support.

@w1th0utnam3
Copy link
Contributor Author

Ah right. I missed that in the version 0.7 PR. I guess this is related to this quick-xml PR then: tafia/quick-xml#555

Hope the sample file helps!

@elrnv
Copy link
Owner

elrnv commented Apr 19, 2023

Yes exactly! Thanks for linking that issue.

@DanW97
Copy link

DanW97 commented Aug 30, 2024

Has tafia/quick-xml#783 managed to resolve blockers on the new release? Or is there more work required to support <AppendedData encoding="raw">-containing vtk files?

@elrnv
Copy link
Owner

elrnv commented Sep 4, 2024

Sadly not yet, because we use the serde API for dealing with XML files here, we also need to extend the serde API to support binary blobs in quick-xml. I started a PR here but don't have much time to finish it. Any help is appreciated of course! I am happy to help any efforts there.

@DanW97
Copy link

DanW97 commented Sep 5, 2024

That's unfortunate. I haven't got loads of time but I am willing to try, if I can be pointed in the right direction for what's needed to finish it. Is it a case of fixing the failing tests or is there more to it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants