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

Creates invalid XML when a dict has keys containing "/" #24

Closed
gdude2002 opened this issue Aug 14, 2014 · 9 comments
Closed

Creates invalid XML when a dict has keys containing "/" #24

gdude2002 opened this issue Aug 14, 2014 · 9 comments

Comments

@gdude2002
Copy link

Let's say I have this JSON..

{
    "routes": {
        "/test/[test variable]": {
            "GET": "A test route"
        },
        "/routes": {
            "GET": "The list of routes in a computer-readable format"
        }
    }
}

This gives us..

<?xml version="1.0" encoding="UTF-8" ?>
<root>
    <routes type="dict">
        </test/[test variable] type="dict">
            <GET type="str">A test route</GET>
        <//test/[test variable]>
        </routes type="dict">
            <GET type="str">The list of routes in a computer-readable format</GET>
        <//routes>
    </routes>
</root>

This is invalid XML. Any ideas?

@quandyfactory
Copy link
Owner

Good catch - thanks for bringing this to my attention. I'll have to update the code so it escapes slashes in key names.

@gdude2002
Copy link
Author

That'd be awesome of you, thanks. We're kind of stuck without this working, heh.

@quandyfactory
Copy link
Owner

I'll try to fix it this afternoon.

@gdude2002
Copy link
Author

<3

On Fri, Aug 15, 2014 at 7:41 PM, Ryan McGreal notifications@github.com
wrote:

I'll try to fix it this afternoon.


Reply to this email directly or view it on GitHub
#24 (comment)
.

@gdude2002
Copy link
Author

Any luck on this, or is it simple enough that I can make a PR?

@quandyfactory
Copy link
Owner

Sorry, I haven't had a chance to tackle this yet. I hope to have some time later today but will try to update you either way.

@quandyfactory
Copy link
Owner

So I've had a chance to look at this and we have the following issue: XML element names can not contain special characters, even if they are escaped. The best we could do is to call the key "key" and put the name of the route in a "name" attribute. If we implement this, your XML output would look like the following:

<?xml version="1.0" encoding="UTF-8" ?>
<root>
    <routes type="dict">
        <key name="/test/[test variable]" type="dict">
            <GET type="str">A test route</GET>
        </key>
        <key name="/routes" type="dict">
            <GET type="str">The list of routes in a computer-readable format</GET>
        </key>
    </routes>
</root>

Does this meet your needs?

@gdude2002
Copy link
Author

That's absolutely fine (and basically what I was expecting). Would be
awesome if we could do this. :3

On Mon, Aug 18, 2014 at 9:26 PM, Ryan McGreal notifications@github.com
wrote:

So I've had a chance to look at this and we have the following issue: XML
element names can not contain special characters, even if they are escaped.
The best we could do is to call the key "key" and put the name of the route
in a "name" attribute. If we implement this, your XML output would look
like the following:

A test route The list of routes in a computer-readable format

Does this meet your needs?


Reply to this email directly or view it on GitHub
#24 (comment)
.

quandyfactory added a commit that referenced this issue Aug 18, 2014
quandyfactory added a commit that referenced this issue Aug 18, 2014
@quandyfactory
Copy link
Owner

Issue should be fixed in v. 1.5.6. Thanks for bringing this issue to my attention.

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

No branches or pull requests

2 participants