Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Siputils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
Siputils
Commits
c7096c51
Commit
c7096c51
authored
4 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-761
: trying to comply with weird XML schema definitions
parent
82c53f87
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/siplib.py
+7
-6
7 additions, 6 deletions
lib/siplib.py
with
7 additions
and
6 deletions
lib/siplib.py
+
7
−
6
View file @
c7096c51
...
@@ -1488,16 +1488,17 @@ class Sip(object):
...
@@ -1488,16 +1488,17 @@ class Sip(object):
raise
Exception
(
"
This SIP does not describe a correlated dataproduct. No subarray pointing available.
"
)
raise
Exception
(
"
This SIP does not describe a correlated dataproduct. No subarray pointing available.
"
)
# this will also validate the document so far
# this will also validate the document so far
def
get_prettyxml
(
self
,
schema_location
:
str
=
None
):
def
get_prettyxml
(
self
):
try
:
try
:
dom
=
self
.
__sip
.
toDOM
()
dom
=
self
.
__sip
.
toDOM
()
dom
.
documentElement
.
setAttribute
(
"
xmlns:xsi
"
,
"
http://www.w3.org/2001/XMLSchema-instance
"
)
dom
.
documentElement
.
setAttribute
(
"
xmlns:xsi
"
,
"
http://www.w3.org/2001/XMLSchema-instance
"
)
if
schema_location
is
None
:
# this is/was the default schema location, even though we never hosted the xsd at the astron server
# XML schema's have a weird way of using namespaces and locations....
# That makes xmllint fail to validate (because the schema obviously can't be found)
# search the internet, everybody thinks it's too complicated,
schema_location
=
"
http://www.astron.nl/SIP-Lofar LTA-SIP-2.7.2.xsd
"
# and that it does not make sense that the schema_location/namespace should be URI's which can be URL's but are not mandated to actually serve the schema at that URL...
schema_location
=
"
http://www.astron.nl/SIP-Lofar
"
dom
.
documentElement
.
setAttribute
(
'
xsi:schemaLocation
'
,
schema_location
)
dom
.
documentElement
.
setAttribute
(
'
xsi:schemaLocation
'
,
schema_location
)
dom
.
documentElement
.
setAttribute
(
'
xmlns:sip
'
,
schema_location
.
split
(
'
'
)[
0
]
)
dom
.
documentElement
.
setAttribute
(
'
xmlns:sip
'
,
schema_location
)
return
dom
.
toprettyxml
()
return
dom
.
toprettyxml
()
except
pyxb
.
ValidationError
as
err
:
except
pyxb
.
ValidationError
as
err
:
logger
.
error
(
err
.
details
())
logger
.
error
(
err
.
details
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment