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

Fix missing text in element error for Python #443

Merged
merged 2 commits into from
Feb 14, 2024

Conversation

empwilli
Copy link
Contributor

@empwilli empwilli commented Feb 8, 2024

Since the XMLPullParser doesn't guarantee that the attributes of a start events are populated. When the parser has not yet encountered the text event, this attribute will be None. Instead we additionally have to check end events, as well.

@mristin
Copy link
Contributor

mristin commented Feb 9, 2024

@empwilli Thanks for the pull request! Do you want me to re-record everything so that the tests pass, or you want to do that yourself?

Since the XMLPullParser doesn't guarantee that the attributes of a start
events are populated. When the parser has not yet encountered the text
event, this attribute will be None. Instead we additionally have to
check end events, as well.
@empwilli empwilli force-pushed the fix/python-xmlization branch from 1af61a1 to 805024b Compare February 9, 2024 10:37
@mristin mristin merged commit 330f391 into aas-core-works:main Feb 14, 2024
8 checks passed
mristin added a commit to aas-core-works/aas-core3.0-python that referenced this pull request 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].

[aas-core-codegen 330f391]: aas-core-works/aas-core-codegen@330f391
mristin added a commit to aas-core-works/aas-core3.0-python that referenced this pull request 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].

[aas-core-codegen 330f391]: aas-core-works/aas-core-codegen@330f391
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.

2 participants