[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] An argument for dropping (deleting) namespaceprefixes when converting XML to JSON
- From: "Liam R. E. Quin" <liam@w3.org>
- To: "Costello, Roger L." <costello@mitre.org>
- Date: Mon, 18 May 2015 14:08:46 -0400
On Mon, 2015-05-18 at 15:48 +0000, Costello, Roger L. wrote:
> Hi Folks,
>
> Consider the bk: namespace prefix in this XML snippet:
>
> <bk:Title>The Adventures of Huckleberry Finn</bk:Title>
>
> How would you convert that XML to JSON? Would you create this JSON:
>
> "bk:Title": "The Adventures of Huckleberry Finn"
I'd probably convert it to something like:
{
"Title" : "The Adventures of Huckleberry Finn",
"xmlns" : "http://www.example.org/titles/"
}
Othewise what do you do if you have a Title element from two different
namespaces intermixed in the same document?
But for additional smarts there's no need to repeat the "xmlns"
binding on contained objects if there's no ambiguity.
Liam
> I will argue against doing that. The bk: prefix has meaning to XML
> parsers and XML applications, but it has no meaning to JSON parsers
> or JSON applications. In fact, the whole notion of namespaces is
> foreign to JSON.
>
> Emulating XML with JSON is a bad idea.
>
> When converting XML to JSON I recommend dropping (deleting) all
> namespace prefixes. Further, drop/delete all namespace declarations.
> Thus, convert the above XML to this JSON:
>
> "Title": "The Adventures of Huckleberry Finn"
>
> If it is necessary to indicate that the Title is a book title, then
> create this JSON:
>
> "Book Title": "The Adventures of Huckleberry Finn"
>
> I invite your thoughts on this issue.
>
> /Roger
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]