Title: XML.toString does not handle the case where JSON keys are not valid XML element names. · Issue #294 · stleary/JSON-java · GitHub
Open Graph Title: XML.toString does not handle the case where JSON keys are not valid XML element names. · Issue #294 · stleary/JSON-java
X Title: XML.toString does not handle the case where JSON keys are not valid XML element names. · Issue #294 · stleary/JSON-java
Description: JSON key names are not as tightly constrained as XML element names - eg: {"6":"x"," this has spaces and quotes"!":"Ouch"} is a valid JSON object, but XML.toString would convert this to <6>x6>< this has spaces and quotes"!>Ouch" this ...
Open Graph Description: JSON key names are not as tightly constrained as XML element names - eg: {"6":"x"," this has spaces and quotes"!":"Ouch"} is a valid JSON object, but XML.toString would convert this to <6>x6>< th...
X Description: JSON key names are not as tightly constrained as XML element names - eg: {"6":"x"," this has spaces and quotes"!":"Ouch"} is a valid JSON object, but XM...
Opengraph URL: https://github.com/stleary/JSON-java/issues/294
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"XML.toString does not handle the case where JSON keys are not valid XML element names.","articleBody":"JSON key names are not as tightly constrained as XML element names - eg:\n {\"6\":\"x\",\" this has spaces and quotes\\\"!\":\"Ouch\"}\n is a valid JSON object, but XML.toString would convert this to \n\u003croot\u003e\u003c6\u003ex\u003c/6\u003e\u003c this has spaces and quotes\"!\u003eOuch\"\u003c/ this has spaces and quotes\"!\u003e\u003c/root\u003e\nWhich is not valid XML. One solution is to prefix element names which start with a digit with _ and replace other invalid characters with an _ too. Whilst this makes the resultant XML valid, meaning can be lost, so to retain the meaning an attribute could be added to provide the original JSON key name. This approach would result in the XML:\n\u003croot\u003e\u003c_6 JSON_Key=\"6\"\u003ex\u003c/6\u003e\u003c_this_has_spaces_and_quotes__ JSONKey=\" this has spaces and quotes\u0026quot;!\"\u003eOuch\"\u003c/_this_has_spaces_and_quotes__\u003e\u003c/root\u003e\n\nSee https://www.w3.org/TR/REC-xml/#NT-Name for constraints on XML element names. Note, \":\" should be replaced with another character as otherwise it could result in an element name which appears to contain a namespace prefix.\n","author":{"url":"https://github.com/imhogan","@type":"Person","name":"imhogan"},"datePublished":"2016-10-14T11:07:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/294/JSON-java/issues/294"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6cfda683-fda3-38ee-780f-ac1209934499 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BDCC:103FB4:11FCDBB:1839E58:6A5B7AA1 |
| html-safe-nonce | b2a6f0663fdcc9d9559bc2a768f8a5918b0ccbc16cad12503237ec7835088c23 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRENDOjEwM0ZCNDoxMUZDREJCOjE4MzlFNTg6NkE1QjdBQTEiLCJ2aXNpdG9yX2lkIjoiMjQ0NDM3NDcyMDExNDI5MzQwOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | de3780f94b45d6c1c4a8c99783be6d97fce8af2fba29b904df1692eb91fb2774 |
| hovercard-subject-tag | issue:183023704 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/stleary/JSON-java/294/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c3280dbc4b0b1cdc2bfd5ddf9308160c855be885625a3148cc7b53235be714c7/stleary/JSON-java/issues/294 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c3280dbc4b0b1cdc2bfd5ddf9308160c855be885625a3148cc7b53235be714c7/stleary/JSON-java/issues/294 |
| og:image:alt | JSON key names are not as tightly constrained as XML element names - eg: {"6":"x"," this has spaces and quotes"!":"Ouch"} is a valid JSON object, but XML.toString would convert this to <6>x6>< th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | imhogan |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/stleary/JSON-java git https://github.com/stleary/JSON-java.git |
| octolytics-dimension-user_id | 5107558 |
| octolytics-dimension-user_login | stleary |
| octolytics-dimension-repository_id | 1187853 |
| octolytics-dimension-repository_nwo | stleary/JSON-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1187853 |
| octolytics-dimension-repository_network_root_nwo | stleary/JSON-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width