Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Enable XML leaf elements #59

Merged
merged 6 commits into from
Mar 21, 2024
Merged

Enable XML leaf elements #59

merged 6 commits into from
Mar 21, 2024

Conversation

JR-1991
Copy link
Collaborator

@JR-1991 JR-1991 commented Mar 18, 2024

This PR introduces the ability to specify leaf elements for XML data models. A leaf element is a terminal string that is encapsulated by the given element. This means, that there are no other elements in the element other than XML attributes. For instance, the following example demonstrates a use case:

XML output

<leafElement someAttr="XYZ">
    This is a simple leaf element
</leafElement>

Within the markdown specs, a leaf element can be configured by setting XML: <Name of the class>, which will signal the sdRDM compiler that the given attribute is to be used as a leaf element. Please note, the XML alias has to have the same name as teh class. Otherwise, a new element will be created.

Markdown

### LeafElement

- value
   - Type: string
   - XML: LeafElement
- someAttr
   - Type: string
   - XML: @someAttr

(Generated code will be the same as usual)

TLDR

  • Allow leaf XML elements
  • Specified by XML: <Class name> --> Turns attribute to function as desired
  • Added tests for leaf element

Closes

closes #20

@JR-1991 JR-1991 added the enhancement New feature or request label Mar 18, 2024
@JR-1991 JR-1991 added this to the 0.3.0 milestone Mar 18, 2024
@JR-1991 JR-1991 self-assigned this Mar 18, 2024
@JR-1991 JR-1991 merged commit 7152c32 into main Mar 21, 2024
3 checks passed
@JR-1991 JR-1991 deleted the xml-leaf-element branch May 12, 2024 00:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lowest level elements in XML cannot have attributes and content
1 participant