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 XMLSCHEMA-64 #3

Merged
merged 4 commits into from
Sep 7, 2023
Merged

Fix XMLSCHEMA-64 #3

merged 4 commits into from
Sep 7, 2023

Conversation

opwvhk
Copy link
Contributor

@opwvhk opwvhk commented Jan 12, 2023

The visitedElements set prevents infinite recursion, but assumes all elements have unique names. But this is only true for top-level names, as demonstrated by the test aded by this PR.

As types are unique (references are replaced by the instance they reference, unlike elements), stopping recursion should happen on element content, rather than element name.

This PR provides a fix, and a test case to prove it works.

opwvhk and others added 4 commits January 12, 2023 22:30
The `visitedElements` set prevents infinite recursion, but assumes all elements have unique names. But this is only true for top-level names.
By stopping recursion only at toplevel elements/types, different subelements with identical names are supported.
`visitedElements` prevents infinite recursion, but assumes all elements
have unique names. This assumption is wrong for non-toplevel elements,
causing elements not to be walked when they should.

But at any start of infinite recursion, the type instance has been
previously visited: either because we've seen the element, or because a
different element refers to the same type.
And as type references resolve the target instance (not a copy, unlike
elements!), we can use type instances to detect infinite recursion.
 Add IntelliJ project directory to ignore list
The typeInfo.getType()==COMPLEX check can differ from the schemaType
implementation (XmlSchemaSimpleType or XmlSchemaComplexType), and
list a complex type as ATOMIC. This happens when referencing an element
with complex content containing a simple type.
@hannsl
Copy link

hannsl commented Mar 13, 2023

Hi, Also running into this problem due to the check on element name rather than type. Would be great if we could get this fixed.

@opwvhk
Copy link
Contributor Author

opwvhk commented Mar 14, 2023 via email

@dkulp dkulp merged commit ccd7ca1 into apache:master Sep 7, 2023
MaxGekk pushed a commit to apache/spark that referenced this pull request Mar 1, 2024
### What changes were proposed in this pull request?
The pr aims to upgrade `xmlschema-core` from `2.3.0` to `2.3.1`.
The previous version was released 2 years ago:
<img width="817" alt="image" src="https://github.com/apache/spark/assets/15246973/8d04f2d7-5a80-47e9-b92e-c1fc2ef3a94c">

### Why are the changes needed?
The new version brings some bug fixes, eg:
https://issues.apache.org/jira/browse/XMLSCHEMA-64
apache/ws-xmlschema#3

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Pass GA.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes #45347 from panbingkun/upgrade_xmlschema.

Authored-by: panbingkun <panbingkun@baidu.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
TakawaAkirayo pushed a commit to TakawaAkirayo/spark that referenced this pull request Mar 4, 2024
### What changes were proposed in this pull request?
The pr aims to upgrade `xmlschema-core` from `2.3.0` to `2.3.1`.
The previous version was released 2 years ago:
<img width="817" alt="image" src="https://github.com/apache/spark/assets/15246973/8d04f2d7-5a80-47e9-b92e-c1fc2ef3a94c">

### Why are the changes needed?
The new version brings some bug fixes, eg:
https://issues.apache.org/jira/browse/XMLSCHEMA-64
apache/ws-xmlschema#3

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Pass GA.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#45347 from panbingkun/upgrade_xmlschema.

Authored-by: panbingkun <panbingkun@baidu.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
ericm-db pushed a commit to ericm-db/spark that referenced this pull request Mar 5, 2024
### What changes were proposed in this pull request?
The pr aims to upgrade `xmlschema-core` from `2.3.0` to `2.3.1`.
The previous version was released 2 years ago:
<img width="817" alt="image" src="https://github.com/apache/spark/assets/15246973/8d04f2d7-5a80-47e9-b92e-c1fc2ef3a94c">

### Why are the changes needed?
The new version brings some bug fixes, eg:
https://issues.apache.org/jira/browse/XMLSCHEMA-64
apache/ws-xmlschema#3

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Pass GA.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#45347 from panbingkun/upgrade_xmlschema.

Authored-by: panbingkun <panbingkun@baidu.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
jpcorreia99 pushed a commit to jpcorreia99/spark that referenced this pull request Mar 12, 2024
### What changes were proposed in this pull request?
The pr aims to upgrade `xmlschema-core` from `2.3.0` to `2.3.1`.
The previous version was released 2 years ago:
<img width="817" alt="image" src="https://github.com/apache/spark/assets/15246973/8d04f2d7-5a80-47e9-b92e-c1fc2ef3a94c">

### Why are the changes needed?
The new version brings some bug fixes, eg:
https://issues.apache.org/jira/browse/XMLSCHEMA-64
apache/ws-xmlschema#3

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Pass GA.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#45347 from panbingkun/upgrade_xmlschema.

Authored-by: panbingkun <panbingkun@baidu.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
@opwvhk opwvhk deleted the patch-1 branch May 18, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants