Re: XML<-> JSON conversion. What do you think?
- From: Max <adsl@xxxxxxxxxx>
- Date: Sun, 10 Aug 2008 12:07:50 +0200
Thomas 'PointedEars' Lahn ha scritto:
Document of which type would not require a precisely correct order of the
elements?
Any custom XML document can not require a correct order of elements...
It would not. A direct conversion could be:
[
{
nodeName: "e",
attributes: {},
childNodes: [
{
nodeName: "#text",
nodeValue: "\n some\n "
},
{
nodeName: "a",
attributes: {},
childNodes: [
{"#text": "textual"}
]
},
{
nodeName: "#text",
nodeValue: "\n content\n"
}
]
}
]
A possibility...
that it would not make sense because it concatenates a text in an array ...
It is you who is not making sense here. "Concatenates a text in an array"?
According to Stefan should be as follows:
"e": "some <a>textual</a> content"
When a JSON converter find two or more #text nodes it create one array with all strings elements:
<e>
some
<a>textual</a>
content
</e>
->
"e": {
"#text": ["some", "content"],
"a": "textual"
}
I think that a JSON converter, in this case, can join strings:
"e": {
"#text": "some content",
"a": "textual"
}
What do you think?
A possibility, but it would involve deserializing the content afterwards.
It would be even more inefficient than to serve XML in the first place.
Yes, I agree with you. In this case, a use of JSON it would be wrong.
.
- Follow-Ups:
- Re: XML<-> JSON conversion. What do you think?
- From: Lasse Reichstein Nielsen
- Re: XML<-> JSON conversion. What do you think?
- From: Thomas 'PointedEars' Lahn
- Re: XML<-> JSON conversion. What do you think?
- References:
- XML<-> JSON conversion. What do you think?
- From: Max
- Re: XML<-> JSON conversion. What do you think?
- From: Thomas 'PointedEars' Lahn
- XML<-> JSON conversion. What do you think?
- Prev by Date: Re: AJAX onreadystatechange function called too many times
- Next by Date: Re: Learning Javascript
- Previous by thread: Re: XML<-> JSON conversion. What do you think?
- Next by thread: Re: XML<-> JSON conversion. What do you think?
- Index(es):
Relevant Pages
|