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

dicttoxml - @attrs not escaping key:value pairs at all #199

Open
ssnyder opened this issue Apr 26, 2024 · 1 comment
Open

dicttoxml - @attrs not escaping key:value pairs at all #199

ssnyder opened this issue Apr 26, 2024 · 1 comment

Comments

@ssnyder
Copy link

ssnyder commented Apr 26, 2024

given the following JSON:

"TagGroup": {
     "@attrs": {
          "Name": "systemSpec",
          "HelpText": "spec version <here>"
     }
}

I load a dictionary as follows:

info_dict['Info']={
    "@attrs":{"Name": "systemSpec",
    "HelpText": "spec version <here>"}
}

I then call:
output_xml = json2xml.dicttoxml.dicttoxml(info_dict, attr_type=False, item_wrap=False, root=False)

Expected Results:
<Info Name="systemSpec" HelpText="spec version &lt;here&gt;" />

Actual results:
<Info Name="systemSpec" HelpText="spec version <here>" />

If there was some way for us to enable/disable the contents of the @attrs to be escaped, that would be great. Even if it is document-wide, it would be a big help to me. My workaround for now, is to do the escaping when building the dictionary, but it should be handled within the dicttoxml call, not in my code.

@vinitkumar
Copy link
Owner

@ssnyder Let me look into this and get back to you on this.

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

Successfully merging a pull request may close this issue.

2 participants