Commit fe8509d8 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[xsd gen] Set schemeURI / listVersionId for element with both content type and a concept

parent e6076aacd3a9
......@@ -214,8 +214,13 @@ class SEDA2XSDExport(EntityAdapter):
if not xselement.duplicated:
type_element = self.element('xsd:complexType', target_element)
content_element = self.element('xsd:simpleContent', parent=type_element)
self.element('xsd:extension', parent=content_element,
attributes={'base': content_type})
extension_element = self.element('xsd:extension', parent=content_element,
attributes={'base': content_type})
else:
extension_element = target_element[0][0][0]
if getattr(target_value, 'cw_etype', None) == 'Concept':
self.concept_scheme_attribute(xselement, extension_element, target_value)
fixed_value = xsd_serialize(target_value)
if fixed_value is not None:
attr = 'default' if hasattr(target_value, 'id') else 'fixed'
......@@ -236,7 +241,7 @@ class SEDA2XSDExport(EntityAdapter):
if getattr(target_value, 'eid', None): # value is an entity
to_process[xselement].append((target_value, target_element))
def fill_concept_element(self, xselement, type_element, target_element, target_value):
def concept_scheme_attribute(self, xselement, type_element, target_value):
try:
xsattr = _xselement_scheme_attribute(xselement)
except KeyError:
......@@ -248,6 +253,9 @@ class SEDA2XSDExport(EntityAdapter):
'type': xsattr.textual_content_type,
'fixed': target_value.scheme.absolute_url()})
type_element.append(scheme_attr)
def fill_concept_element(self, xselement, type_element, target_element, target_value):
self.concept_scheme_attribute(xselement, type_element, target_value)
target_element.attrib['fixed'] = xsd_serialize(target_value)
def fill_organization_element(self, parent_element, value):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment