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

Convert with plugin line to xerces #1451

Closed
markus2330 opened this issue Apr 4, 2017 · 3 comments
Closed

Convert with plugin line to xerces #1451

markus2330 opened this issue Apr 4, 2017 · 3 comments
Assignees

Comments

@markus2330
Copy link
Contributor

I tried to convert a snippet on the website, but got the error: CONVERT_UNABLE_TO_CONVERT_SNIPPET

Used plugins

Input:
- Plugin: line
- Format: line
- Additional config: 
Output:
- Plugin: xerces
- Format: xml
- Additional config: 

Input configuration

a
b

Last output configuration


Additional information

@e1528532
Copy link
Contributor

e1528532 commented Apr 4, 2017

I checked how the line plugin saves its content, and apparently it saves the input as an array of lines, so if we assume user/test/line as the basis, we get user/test/line/#0 =a and user/test/line/#1=b. In XML this would naturally mean that there are two elements called line, so it would correspond to

<line/>
<line/>

but as line is the root element in this case, and there can be only one root, this is currently incompatible with the xerces plugin. I'd have to create a workaround to treat the root element differently in case its an array, but I'm not sure if this is a good idea to do. The data represented here is just not naturally suited to the xml format due to several root elements.

I found out this always happens with the line plugin because even if there is only 1 line it saves it as an array. If you think it makes sense i can make a workaround that allows arrays with 1 element as being the root key for the export.

If we decide to leave it like it is, i'd add this hint to the limitations of the readme though.

@markus2330
Copy link
Contributor Author

Yes, leave like it is. Please document the limitation and also link here.

We could extend the rename plugin to introduce root elements in such cases.

e1528532 added a commit to e1528532/libelektra that referenced this issue Apr 4, 2017
@e1528532
Copy link
Contributor

e1528532 commented Apr 4, 2017

updated documentation including link to here in #1450

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants