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

GbXMLReverseTranslator schema validation using wrong schema version #5319

Open
macumber opened this issue Dec 18, 2024 · 1 comment
Open
Labels
Triage Issue needs to be assessed and labeled, further information on reported might be needed

Comments

@macumber
Copy link
Contributor

macumber commented Dec 18, 2024

Issue overview

The GbXMLReverseTranslator performs a schema validation using GreenBuildingXML_Ver7.03.xsd no matter which version of gbXML is being translated. This gives false errors about gbXML files being invalid when translating gbXML files which are valid against older gbXML schema versions. This includes some of the test files such as
https://github.com/NREL/OpenStudio/blob/develop/resources/gbxml/gbXMLStandard_Single_Family_Residential_2016.xml

Current Behavior

This line always validates the gbXML being translated against the GreenBuildingXML_Ver7.03.xsd

https://github.com/NREL/OpenStudio/blob/develop/src/utilities/xml/XMLValidator.cpp#L480

Expected Behavior

The gbXML should be validated against whichever version of the gbXML schema it references using the version attribute https://www.ivoa.net/documents/Notes/XMLVers/20180529/EN-schemaVersioning-1.0-20180529.html#tth_sEc2.2.1

Steps to Reproduce

require 'openstudio'

file = "gbXMLStandard_Single_Family_Residential_2016.xml"

# translate the model
# this will print out incorrect XMLValidator errors/warnings as well as GbXMLReverseTranslator errors/warnings
rt = OpenStudio::GbXML::GbXMLReverseTranslator.new
model = rt.loadModel(file)
#puts model.get
model.get.save("translated.osm", true)

Possible Solution

Include copies of all the gbXML schema files and select the correct one based on the xml version attribute.

Even better would be to implement some sort of version translator for gbXML files. However, this would clearly be an enhancement vs a bug fix.

Details

Environment

Some additional details about your environment for this issue (if relevant):

  • Platform (Operating system, version):
  • Version of OpenStudio (if using an intermediate build, include SHA):

Context

It is confusing to see messages saying that a gbXML file is not valid against the schema when it actually is (when compared to the correct version of the schema).

@macumber macumber added the Triage Issue needs to be assessed and labeled, further information on reported might be needed label Dec 18, 2024
@jmarrec
Copy link
Collaborator

jmarrec commented Dec 18, 2024

The RT rules are written to target the gbxml schema Version 7.03 - August 2023.

There is absolutely no guarantee being given that we support files created with an older schema.

Maybe we could actually look for that version attribute and give a clearer warning though.

jmarrec added a commit that referenced this issue Dec 18, 2024
jmarrec added a commit that referenced this issue Dec 18, 2024
jmarrec added a commit that referenced this issue Dec 18, 2024
jmarrec added a commit that referenced this issue Dec 18, 2024
jmarrec added a commit that referenced this issue Dec 19, 2024
#5319 - gbXML Reverse Translator - Scan for the gbxml Schema version: skip schema validation with a warning when not 7.03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage Issue needs to be assessed and labeled, further information on reported might be needed
Projects
None yet
Development

No branches or pull requests

2 participants