-
Notifications
You must be signed in to change notification settings - Fork 33
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
Parker convention is not implemented correctly #40
Comments
So xmljson (this project) returns this: {
"person": [
{
"age": 12,
"height": 1.73
}, {
"age": 12,
"height": 1.73
}
]
} Or this when using {
"root": {
"person": [
{
"age": 12,
"height": 1.73
}, {
"age": 12,
"height": 1.73
}
]
}
} To me the XSLT translation seems wrong, it removes information (i.e. the |
BTW Looking at the examples at https://github.com/doekman/xml2json-xslt/tree/master/unittests your depiction of what xml2json-xslt returns is incorrect, it does not turn the root-element into an element named |
That repository is a reference implementation of Parker convention.
I think it makes perfect sense, because in XML you usually have something like: <people>
<person>
<name>John</name>
<age>10</age>
</person>
</people> And in JSON you usually don't want to see
I generated output examples using the XSLT file and |
Input: https://github.com/doekman/xml2json-xslt/blob/master/unittests/issue1.xml Root element seems to be preserved actually |
@AndreiPashkin Exactly, so your example above is incorrect. And the output is the same as xmljson. |
That seems very wrong. Why would someone want to see a sub-element (i.e. |
Hm, that is correct. I don't why why |
The redundancy is in the original data, why would a conversion remove a sub-element layer. That doesn't make sense. A conversion has no semantics. Maybe you were confused or your examples were wrong and you wanted to preserve/remove the root-element. That is possible with xmljson using
But there does not seem to be a problem, so can I close this issue ? |
In the original data there is no redundancy. How else would you express array of person-elements in XML? Only with person-tags. But in JSON equivalent of person-tags are dictionaries themselves. Also - that's how Parker convention defines it. I think it makes sense to implement a standard according to the standard. |
It seems like the way of how the library converts XML using Parker convention differs from how it's defined originally in this repository:
https://github.com/doekman/xml2json-xslt
Here is the comparison:
Input data
Using xmltodict
Output:
Using XSLT document from the original Google repository
Output:
The text was updated successfully, but these errors were encountered: