Skip to content

Undoing restriction attributes for some complex xxxRefStructure, fixing problems in the spp,fixing a missing include in two files for VehicleRef, fixes problem with WSDL generation#976

Merged
TuThoThai merged 13 commits intonextfrom
fix_complex_ref
Nov 12, 2025
Merged

Conversation

@TuThoThai
Copy link
Copy Markdown
Contributor

@TuThoThai TuThoThai commented Oct 23, 2025

This fixes small bugs I have found after we merged #975, mostly due to the fact that it creates a double contraint on xxxRefStructure for items for which the restriction is defined just after in the XSD by using:
<xsd:restriction base="xxxRefStructure"/> that is linked to a complexType in which the attributes restrictions are alreay listed.

Namely, I am undoing the restriction for:

  • AllCountriesRef
  • AllTransportOrganisationsRefStructure
  • AllPublicTransportOrganisationsRefStructure
  • AllOperatorsRefStructure

It also removes some files in the project file that no longer exist.

It fixes some problems with the WSDL generation from the project

For this one, the double restriction does not work as it generates a weird loop by adding <xsd:attribute name="ref" type="TypeOfValueIdType" use="required"> under the restriction
Undo the restriction on AllTransportOrganisationsRefStructure, AllPublicTransportOrganisationsRefStructure, and AllOperatorsRefStructure due to it creating a double contraints with the complexType
@TuThoThai TuThoThai added this to the netex_2.0 milestone Oct 23, 2025
@TuThoThai TuThoThai added the bug Technical mistake, inconsistency with the documentation, etc. label Oct 23, 2025
@skinkie
Copy link
Copy Markdown
Contributor

skinkie commented Oct 23, 2025

Your interpretation is not correct. A restriction must name everything under it, hence if it is not named, it does not exist. There is no double constraint.

So while I can agree with the change, because it seems that those element in fact have a meaning, the reason why you are proposing it, is wrong.

@TuThoThai
Copy link
Copy Markdown
Contributor Author

Your interpretation is not correct. A restriction must name everything under it, hence if it is not named, it does not exist. There is no double constraint.

So while I can agree with the change, because it seems that those element in fact have a meaning, the reason why you are proposing it, is wrong.

Chances are very high that I express my understanding wrongly. But, the way I read it is the above mentioned xxxRef or xxxRefStructure were part of Substition Groups for which the restriction was already existing.

@skinkie
Copy link
Copy Markdown
Contributor

skinkie commented Oct 23, 2025

Chances are very high that I express my understanding wrongly. But, the way I read it is the above mentioned xxxRef or xxxRefStructure were part of Substition Groups for which the restriction was already existing.

Then you just understand it wrong. There are never double constraints.

@TuThoThai
Copy link
Copy Markdown
Contributor Author

Then you just understand it wrong. There are never double constraints.

Apologies if the way I express what I see is using the wrong word. Sharing how I found the errors and the interpertation I had.
Steps:

  1. Download the entire XSD from the next branch
  2. Open it on XMLSpy
  3. Cross-check some of my datasets
    I admit that I should have done that as we were reviewing your PRs @skinkie, so my bad.

At step 2, these errors were flagged:
Capture d'écran 2025-10-24 105320

And, when I went to the XSD schema, I read this:
Capture d'écran 2025-10-24 105421

So, the way I interpreted it is the 2 times restriction on TypeOfValueIdType was creating an issue. Hence me expressing it with "double contraint", which is not the most appropriate.
Regardless of how my brain was labelling it, in this PR I propose changes so that the only the 2nd restriction in the XSD is kept. So, the XSD can validate while the logic of our new checks preserved.

Is is clearer for review, @skinkie?

@skinkie
Copy link
Copy Markdown
Contributor

skinkie commented Oct 24, 2025

Lets say first, these errors should be reported in xmllint too, they are not on this topic, and I am very sure they were on others. So that is interesting.

The first error mentions that an anonymous (thus a ComplexType as part of an element) is not valid. What I think that it wants to explain you is that the AllTransportOrganisationsRefStructure has a different restriction. Or that name="nameOfRefClass" type="NameOfClass" may not be the correct restriction.

This is not a fix, it is just reverting what it was. And since extension essentially copies the restriction 1:1 it resolves it.

My suggestion if you are in xmlspy maybe there is an option to convert the extension to a restriction, and see what the differences are.

@ue71603 anything you know that is possible?

@ue71603
Copy link
Copy Markdown
Contributor

ue71603 commented Oct 24, 2025

@TuThoThai @skinkie I see the error as well
image

ue71603
ue71603 previously approved these changes Oct 24, 2025
Copy link
Copy Markdown
Contributor

@ue71603 ue71603 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just replicated the work. so I agree

@ue71603 ue71603 self-requested a review October 24, 2025 15:12
@skinkie
Copy link
Copy Markdown
Contributor

skinkie commented Oct 24, 2025

@ue71603 this is not something to agree with. The proposed is not a fix, it is just reverting what has been created. The question was: can xmlspy suggest what the restriction should look like to be correctly derived.

@ue71603
Copy link
Copy Markdown
Contributor

ue71603 commented Oct 24, 2025

a lot was missing the fixed="All" in ref.

@TuThoThai
Copy link
Copy Markdown
Contributor Author

@skinkie, I did spent a bit of time trying all combination that you have in the drop-down list of XMLSpy to make a valid schema. And the only correct sequence is:

	<xsd:element name="AllCountriesRef">
		<xsd:annotation>
			<xsd:documentation>Reference to a country ISO 3166-1 Note that GB is used for UK . May be qualified with a 3166-2 subdivision e.g. gb +m ENG, GB + SCT, GB See www.iso.org/iso/country_codes/iso_3166_code_lists.htm.</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:simpleContent>
				<xsd:restriction base="AllCountriesRefStructure" />
			</xsd:simpleContent>
		</xsd:complexType>	
	</xsd:element>
	<xsd:complexType name="AllCountriesRefStructure">
		<xsd:annotation>
			<xsd:documentation>Type for a reference All Countries.</xsd:documentation>
		</xsd:annotation>
		<xsd:simpleContent>
			<xsd:restriction base="TypeOfValueRefStructure">
				<xsd:attribute name="ref" type="TypeOfValueIdType" use="required" fixed="All">
					<xsd:annotation>
						<xsd:documentation>Iso 3166-1 Two Character country code.</xsd:documentation>
					</xsd:annotation>
				</xsd:attribute>
			</xsd:restriction>
		</xsd:simpleContent>
	</xsd:complexType>

Which equals to reverting your PR on 4 elements only. I think it would be best to accept this for now and rework that part for v2.1 or v3.0.

@skinkie
Copy link
Copy Markdown
Contributor

skinkie commented Oct 24, 2025

				<xsd:restriction base="AllCountriesRefStructure" />

This is wrong. Because all attributes below are then ommited.

@TuThoThai
Copy link
Copy Markdown
Contributor Author

This is wrong. Because all attributes below are then ommited.

The way I read it is that the XSD sends you to the restrictions listed below in the AllCountriesRefStructure which then is:

<xsd:restriction base="TypeOfValueRefStructure">
  <xsd:attribute name="ref" type="TypeOfValueIdType" use="required" fixed="All">
	  <xsd:annotation>
		  <xsd:documentation>Iso 3166-1 Two Character country code.</xsd:documentation>
	  </xsd:annotation>
  </xsd:attribute>
</xsd:restriction>

Comment thread NeTEx.spp
Comment thread NeTEx.spp
Comment thread NeTEx.spp
@ue71603 ue71603 changed the title Undoing restriction attributes for some complex xxxRefStructure Undoing restriction attributes for some complex xxxRefStructure, fixing problems in the spp,fixing a missing include in two files for VehicleRef Oct 24, 2025
ue71603
ue71603 previously approved these changes Oct 25, 2025
@ue71603 ue71603 changed the title Undoing restriction attributes for some complex xxxRefStructure, fixing problems in the spp,fixing a missing include in two files for VehicleRef Undoing restriction attributes for some complex xxxRefStructure, fixing problems in the spp,fixing a missing include in two files for VehicleRef, fixes problem with WSDL generation Oct 25, 2025
* undoing two problems he identified.
@TuThoThai
Copy link
Copy Markdown
Contributor Author

Thanks for fixing the last items, @ue71603! Looks good to me 🙏

@ue71603
Copy link
Copy Markdown
Contributor

ue71603 commented Oct 27, 2025

@skinkie sorry. still not clear. the fixed="All" is gone at that location.
fixed="All" we only have now here:
image

@skinkie
Copy link
Copy Markdown
Contributor

skinkie commented Oct 27, 2025

@skinkie sorry. still not clear. the fixed="All" is gone at that location. fixed="All" we only have now here: image

Remove the entire ref attribute, if possible.

@TuThoThai TuThoThai mentioned this pull request Oct 30, 2025
21 tasks
@TuThoThai TuThoThai requested review from skinkie and ue71603 November 8, 2025 19:14
Copy link
Copy Markdown
Contributor

@skinkie skinkie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unhappy with the complexContent to simpleContent. But if it works, I am ok.

@TuThoThai TuThoThai requested a review from Aurige November 12, 2025 10:09
Copy link
Copy Markdown
Contributor

@thbar thbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TuThoThai TuThoThai merged commit ba5aa42 into next Nov 12, 2025
@TuThoThai TuThoThai deleted the fix_complex_ref branch February 17, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Technical mistake, inconsistency with the documentation, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants