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

Namespaced xml #69

Merged
merged 3 commits into from Dec 8, 2021
Merged

Namespaced xml #69

merged 3 commits into from Dec 8, 2021

Conversation

TommasoPino
Copy link
Contributor

I prepared this modification in order to handle the reading of an OEM file in XML format that has a namespace in it. The modification will remove from the tag the namespace, it is transparent for XML files without namespace.

TommasoPino and others added 2 commits October 1, 2021 12:32
removed check of CI_COMMIT_TAG env variable
@bradsease
Copy link
Owner

Hi @TommasoPino, thanks for your contribution! I'm not too familiar with XML namespaces. Do you have an example of an XML OEM with that format?

@TommasoPino
Copy link
Contributor Author

The following XML is a close example of what my client asked me to process.
The xmlns field of OEM structure will be added to all fields by lxml where for example OBJECT_NAME will be {urn:ccsds:schema:ndmxml}OBJECT_NAME.

To avoid that I followed the solution found in this StackOverflow answer here

<?xml version="1.0" encoding="UTF-8"?>
<oem xmlns="urn:ccsds:schema:ndmxml" id="CCSDS_OEM_VERS" version="2.0">
	<header>
		<COMMENT>This is a comment</COMMENT>
		<CREATION_DATE>2021-09-28T08:28:09.279</CREATION_DATE>
		<ORIGINATOR>Generator</ORIGINATOR>
	</header>
	<body>
		<segment>
			<metadata>
				<OBJECT_NAME>Satellite</OBJECT_NAME>
				<OBJECT_ID>12345</OBJECT_ID>
				<CENTER_NAME>EARTH</CENTER_NAME>
				<REF_FRAME>EME2000</REF_FRAME>
				<TIME_SYSTEM>UTC</TIME_SYSTEM>
				<START_TIME>2016-12-31T00:00:00.000</START_TIME>
				<STOP_TIME>2017-01-07T23:59:59.000</STOP_TIME>
			</metadata>
			<data>
				<COMMENT>This is a comment</COMMENT>
				<stateVector>
					<EPOCH>2016-12-31T00:00:00.000</EPOCH>
					<X>1548.73660685606500000000</X>
					<Y>6453.91396525065830000000</Y>
					<Z>-2.20667257529390650000</Z>
					<X_DOT>0.94202103371824331000</X_DOT>
					<Y_DOT>-0.22525219323386808000</Y_DOT>
					<Z_DOT>7.77861731494300630000</Z_DOT>
				</stateVector>
				<stateVector>
					<EPOCH>2016-12-31T00:02:00.000</EPOCH>
					<X>1647.49906289765250000000</X>
					<Y>6467.07303631885220000000</Y>
					<Z>904.50945583217378000000</Z>
					<X_DOT>0.70153204546164949000</X_DOT>
					<Y_DOT>-1.21997704279991210000</Y_DOT>
					<Z_DOT>7.71053662286629200000</Z_DOT>
				</stateVector>
				<stateVector>
					<EPOCH>2016-12-31T00:04:00.000</EPOCH>
					<X>1716.59626399367310000000</X>
					<Y>6461.98950104656070000000</Y>
					<Z>1794.89313078469630000000</Z>
					<X_DOT>0.44835037270326061000</X_DOT>
					<Y_DOT>-2.19296583274764820000</Y_DOT>
					<Z_DOT>7.60681540029509070000</Z_DOT>
				</stateVector>
			</data>
		</segment>
	</body>
</oem>

@bradsease
Copy link
Owner

Apologies for losing track of this -- I think I understand now. If you revert the changes to setup.py I can merge this in.

reverting to the original setup.py
@TommasoPino
Copy link
Contributor Author

Hello @bradsease. As asked, I reverted the setup.py file.
Have a nice day.

@TommasoPino
Copy link
Contributor Author

Just a question, I encountered a problem installing the package directly from the repository due to the setup.py line you asked me to revert. It is possible to generalize the setup.py to avoid this problem. A "setup.cfg" could be useful in that sense

@bradsease bradsease merged commit f5af694 into bradsease:main Dec 8, 2021
bradsease pushed a commit that referenced this pull request Dec 8, 2021
* handle reading of namespaced xml OEM

* Update setup.py

removed check of CI_COMMIT_TAG env variable

* Update setup.py

reverting to the original setup.py
@bradsease
Copy link
Owner

Sorry about that -- I'll work on making that more general. I was focused on getting it to work with my CI/CD and didn't think about local use.

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.

None yet

2 participants