Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML with entities like < get screwed up. #61

Closed
forbesmyester opened this issue Dec 12, 2020 · 3 comments · Fixed by #63
Closed

XML with entities like < get screwed up. #61

forbesmyester opened this issue Dec 12, 2020 · 3 comments · Fixed by #63
Assignees
Labels
bug Something isn't working

Comments

@forbesmyester
Copy link

Describe the bug
Escaping in XML does not work properly (when the string is already there)

To Reproduce
Save file as es_systems.cfg

<?xml version="1.0"?>
<systemList>
  <system>
    <name>retropie</name>
    <fullname>RetroPie</fullname>
    <path>/home/fozz/RetroPie/retropiemenu</path>
    <extension>.rp .sh</extension>
    <command>sudo /home/fozz/RetroPie-Setup/retropie_packages.sh retropiemenu launch %ROM% &lt;/dev/tty &gt;/dev/tty</command>
    <platform/>
    <theme>retropie</theme>
  </system>
</systemList>

and run the command

cat es_systems.cfg | dasel put string -p xml a .systemList x

Expected behavior
The &lt;/dev/tty &gt; should have been retained, it also should have not generated an invalid document (it put in < instead of &lt;)

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Version: development - 971ac93
@forbesmyester forbesmyester added the bug Something isn't working label Dec 12, 2020
@TomWright TomWright self-assigned this Dec 14, 2020
@TomWright
Copy link
Owner

Thanks for raising this issue @forbesmyester.

This is an issue with the XML parser being used - I've raised an issue with them: clbanning/mxj#84

@TomWright
Copy link
Owner

TomWright commented Dec 14, 2020

This has been fixed as of v1.9.1: https://dasel.tomwright.me/s/0be94bad-15e5-4d37-b2d4-24bf054a856c

$ echo '<systemList>
  <system>
    <name>retropie</name>
    <fullname>RetroPie</fullname>
    <path>/home/fozz/RetroPie/retropiemenu</path>
    <extension>.rp .sh</extension>
    <command>sudo /home/fozz/RetroPie-Setup/retropie_packages.sh retropiemenu launch %ROM% &lt;/dev/tty &gt;/dev/tty</command>
    <platform/>
    <theme>retropie</theme>
  </system>
</systemList>' | dasel put string -p xml .newElement newValue
<doc>
  <newElement>newValue</newElement>
  <systemList>
    <system>
      <command>sudo /home/fozz/RetroPie-Setup/retropie_packages.sh retropiemenu launch %ROM% &lt;/dev/tty &gt;/dev/tty</command>
      <extension>.rp .sh</extension>
      <fullname>RetroPie</fullname>
      <name>retropie</name>
      <path>/home/fozz/RetroPie/retropiemenu</path>
      <platform/>
      <theme>retropie</theme>
    </system>
  </systemList>
</doc>

@forbesmyester
Copy link
Author

forbesmyester commented Dec 16, 2020

Awesome, efficiency.
Also am loving the tool too
Thanks for maintaining it :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants