Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

XML parsing breaks using escapes #2487

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 10 comments
Closed

XML parsing breaks using escapes #2487

openstreetmap-trac opened this issue Jul 23, 2021 · 10 comments

Comments

@openstreetmap-trac
Copy link

Reporter: stefan[at]konink.de
[Submitted to the original trac issue database at 8.03pm, Saturday, 21st November 2009]

The following is send to the API
<tag k='name' v='Lijn 31 van DEN HAAG naar NAALDWIJK via MONSTER en 's-GRAVENZANDE' />

This comes back in the XML error:
<tag k='name' v='Lijn 31 van DEN HAAG naar NAALDWIJK via MONSTER en 's-GRAVENZANDE' />

Escape chars shouldn't be ignored.

@openstreetmap-trac
Copy link
Author

Author: TomH
[Added to the original trac issue at 11.00pm, Saturday, 21st November 2009]

Can you clarify what the problem is? Are you saying that trying to upload that object results in an error? or that if you upload it and then download it again the backslash is lost?

@openstreetmap-trac
Copy link
Author

Author: stefan[at]konink.de
[Added to the original trac issue at 11.16pm, Saturday, 21st November 2009]

I am trying to upload an object including the first above tag. That object returns an XML error. And the XML error clearly shows that it has lost the escaping slash.

@openstreetmap-trac
Copy link
Author

Author: stefan[at]konink.de
[Added to the original trac issue at 11.17pm, Saturday, 21st November 2009]

...and to be totally clear. If I replace it with a "bla '" sequence it works.

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 12.00am, Sunday, 22nd November 2009]

What does the error say exactly? Presumably it doesn't just quote the XML but has some sort of error message?

@openstreetmap-trac
Copy link
Author

Author: stefan[at]konink.de
[Added to the original trac issue at 12.10am, Sunday, 22nd November 2009]

Uploaded:
<tag k='name' v='Lijn 31 van DEN HAAG naar NAALDWIJK via MONSTER en 's-GRAVENZANDE' />

Error:
Cannot parse valid relation from xml string <tag k='name' v='Lijn 31 van DEN HAAG naar NAALDWIJK via MONSTER en 's-GRAVENZANDE' />

@openstreetmap-trac
Copy link
Author

Author: stefan[at]konink.de
[Added to the original trac issue at 12.11am, Sunday, 22nd November 2009]

Interesting now I see that the error that I made up actually has the \ so probably someone is working on it.

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 12.12am, Sunday, 22nd November 2009]

Nobody is working on anything...

One for you I guess zere?

@openstreetmap-trac
Copy link
Author

Author: stefan[at]konink.de
[Added to the original trac issue at 12.15am, Sunday, 22nd November 2009]

Lets say I expect this difference is between a /create vs an update.

@openstreetmap-trac
Copy link
Author

Author: Matt
[Added to the original trac issue at 3.01am, Sunday, 22nd November 2009]

i've tested the code for both create and update and, for me, they both return the same error message with the correct escaping. if you can still reproduce this difference, it would help us a lot if you could post a trace of the relevant parts of the server conversation (e.g: curl --trace).

i'm sure you already know this, but backslashes do not escape chars in XML attributes. instead to escape the single quote use '. the original error is due to the XML parser terminating on the minus sign after the single quote after the backslash, as this is an invalid character in that context.

@openstreetmap-trac
Copy link
Author

Author: Matt
[Added to the original trac issue at 12.39am, Wednesday, 25th November 2009]

closing because there doesn't seem to be a reproducible issue here.

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

No branches or pull requests

1 participant