Repository navigation
Replies: 1 comment
|
An empty XML element is read as a string, so assigning an attribute underneath it fails because there isn't a map to put With v3.11.2, you can replace that empty element's value with a map containing the attribute: dasel -i xml -o xml --root \
'greddle.bar.baz = {"-id": "test_ood"}' \
< dasel_test.xml > dasel_test.updated.xmlI tested this against your sample. It produced: <greddle>
<bar>
<baz id="test_ood"></baz>
<fizz id=""></fizz>
</bar>
</greddle>
See the v3 modification examples. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello all,
I'm attempting to use Dasel to modify an existing XML file.
Adding or Updating elements works fine.
Updating an existing attribute works fine.
However, I'm stuck with the creation of new attribute:
Sample File: dasel_test.xml
I can update the greddle.bar.fizz element with:
~/bin/dasel_linux_386 put -f dasel_test.xml -r xml --pretty=true -v 'test_ood' 'greddle.bar.fizz.-id'However, attempts to add the attribute 'id' to the baz element fails:
Is this possible within Dasel - if so, can someone point me to what I'm missing?
All reactions