|
3 | 3 |
|
4 | 4 | from lxml import etree |
5 | 5 |
|
6 | | -from reqif.helpers.lxml import stringify_namespaced_children |
| 6 | +from reqif.helpers.lxml import ( |
| 7 | + lxml_convert_children_from_reqif_ns_xhtml_string, |
| 8 | + stringify_namespaced_children, |
| 9 | +) |
| 10 | +from reqif.helpers.string.xhtml_indent import reqif_unindent_xhtml_string |
7 | 11 | from reqif.models.reqif_spec_object import ( |
8 | 12 | ReqIFSpecObject, |
9 | 13 | SpecObjectAttribute, |
@@ -202,16 +206,20 @@ def parse(spec_object_xml) -> ReqIFSpecObject: |
202 | 206 | elif attribute_xml.tag == "ATTRIBUTE-VALUE-XHTML": |
203 | 207 | the_value = attribute_xml.find("THE-VALUE") |
204 | 208 | attribute_value = stringify_namespaced_children(the_value) |
| 209 | + attribute_value_stripped_xhtml = reqif_unindent_xhtml_string( |
| 210 | + lxml_convert_children_from_reqif_ns_xhtml_string(the_value) |
| 211 | + ) |
205 | 212 | attribute_definition_ref = ( |
206 | 213 | attribute_xml.find("DEFINITION") |
207 | 214 | .find("ATTRIBUTE-DEFINITION-XHTML-REF") |
208 | 215 | .text |
209 | 216 | ) |
210 | 217 | attribute = SpecObjectAttribute( |
211 | | - xml_node=attribute_xml, |
212 | 218 | attribute_type=SpecObjectAttributeType.XHTML, |
213 | 219 | definition_ref=attribute_definition_ref, |
214 | 220 | value=attribute_value, |
| 221 | + value_stripped_xhtml=attribute_value_stripped_xhtml, |
| 222 | + xml_node=attribute_xml, |
215 | 223 | ) |
216 | 224 | else: |
217 | 225 | raise NotImplementedError(etree.tostring(attribute_xml)) |
|
0 commit comments