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

Test and fix for text attached to end XML elements #18

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

mristin
Copy link
Contributor

@mristin mristin commented Feb 14, 2024

The ElementTree's XMLPullParser sometimes attaches the text to the start element and sometimes to the end element. We could not figure out why there is a different behavior, but suspect that it has something to do with the size of the parser buffer.

In this patch, we fix by looking for text in both events (start as well as end element).

This is related to the issue #17, and based on the aas-core-codegen after the pull request
aas-core-works/aas-core-codegen#443 has been merged in, aas-core-codegen 330f391.

The ElementTree's `XMLPullParser` sometimes attaches the text to the
start element and sometimes to the end element. We could not figure out
why there is a different behavior, but suspect that it has something to
do with the size of the parser buffer.

In this patch, we fix by looking for text in both events (start as well
as end element).

This is related to the issue #17, and based on the aas-core-codegen
after the pull request
aas-core-works/aas-core-codegen#443 has been
merged in, [aas-core-codegen 330f391].

[aas-core-codegen 330f391]: aas-core-works/aas-core-codegen@330f391
@mristin mristin merged commit 8b1eddd into main Feb 14, 2024
5 checks passed
@mristin mristin deleted the mristin/Test-and-fix-for-text-in-end-XML-element branch February 14, 2024 19:12
mristin added a commit that referenced this pull request Feb 14, 2024
* Test and fix for text attached to end XML elements (#18).

  This patch fixes for the edge case where ElementTree's
  ```XMLPullParser`` attaches the text to the end element instead of
  the start element. Previously, some XML files were wrongly reported
  as incorrect.

  We do not know what causes this different behavior of the parser,
  but suspect that it has something to do with the size of the parser's
  buffer.
@mristin mristin mentioned this pull request Feb 14, 2024
mristin added a commit that referenced this pull request Feb 14, 2024
* Test and fix for text attached to end XML elements (#18).

  This patch fixes for the edge case where ElementTree's
  ```XMLPullParser`` attaches the text to the end element instead of
  the start element. Previously, some XML files were wrongly reported
  as incorrect.

  We do not know what causes this different behavior of the parser,
  but suspect that it has something to do with the size of the parser's
  buffer.
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

Successfully merging this pull request may close these issues.

1 participant