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

n42 xml file created by SpecUtils is not valid according to xsd #12

Open
arichnad opened this issue Jan 20, 2023 · 1 comment
Open

n42 xml file created by SpecUtils is not valid according to xsd #12

arichnad opened this issue Jan 20, 2023 · 1 comment

Comments

@arichnad
Copy link
Contributor

arichnad commented Jan 20, 2023

Hello,

issue-input.txt
issue-output.txt
(files added as .txt extension due to issue restriction)

I run the following valid 2012 n42 xml file through SpecUtils, and it creates a 2012 n42 xml that fails schema validation.

$ xmlstarlet val --err --xsd SpecUtils/unit_tests/test_data/schema/n42.xsd issue-input.xml
issue-input.xml - valid

It creates two errors. xmlstarlet val --err --xsd SpecUtils/unit_tests/test_data/schema/n42.xsd issue-output.xml

  1. An InterSpec definition needs to be added to the xml header:
22.27: Namespace prefix InterSpec on DetectorType is not defined
			<InterSpec:DetectorType>RS-701</InterSpec:DetectorType>
  1. And, it also creates a RadInstrementState that lacks a ref:
41.22: Element '{http://physics.nist.gov/N42/2011/N42}RadInstrumentState': The attribute 'radInstrumentInformationReference' is required but missing.

Using this:

SpecFile specFile;
if(!specFile.load_N42_from_data(inputContent)) {
	return;
}
specFile.write_to_file(outputFilename, SaveSpectrumAsType::N42_2012);

Thanks,

arichnad

wcjohns added a commit that referenced this issue Jan 20, 2023
…mationReference attribute.

This is an error pointed out by @arichnad in issue #12.
wcjohns added a commit that referenced this issue Jan 20, 2023
This is needed, as pointed out by @arichnad in issue #12.
@wcjohns
Copy link
Collaborator

wcjohns commented Jan 20, 2023

Hi @arichnad ,

Thanks for pointing these issues out!

I just pushed a fixes for the second issue in a2bc413.
While checking this fix out, I also noticed RelativeLocation elements are lacking a required Origin child element; I wouldnt be surprised if there were a few more issues like this - its been a few years since I've validated the output XML.

The first issue is related to sandialabs/InterSpec#14, and looks to require defining an xsd file.

I'll bump defining this xsd file up in priority on my TODO list, but cant promise a date when they will be fixed by.

thanks again,
-will

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

No branches or pull requests

2 participants