You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Norman Barker <no...@gmail.com> on 2009/10/14 18:43:38 UTC
json referencing using private member
Hi,
I am using JSON referencing in couchdb and the input is XML (which I
am turning into JSON).
An immediate problem is that by taking a JSON object out of CouchDB is
that you don't know the name of the corresponding XML root element.
e.g. "RootName" : {"$ref" : "123"}, where document corresponding
object to "123" contains the child elements of RootName.
Using private CouchDB JSON notation, similar to _id, _rev, I would
like to use _parent to specify the parent root name.
Is this safe, is there a list of reserved words in couchdb?
thanks,
Norman
Re: json referencing using private member
Posted by Norman Barker <no...@gmail.com>.
On Wed, Oct 14, 2009 at 11:08 AM, Chris Anderson <jc...@apache.org> wrote:
> On Wed, Oct 14, 2009 at 9:52 AM, Norman Barker <no...@gmail.com> wrote:
>> ok, thought so - in that case can we reserve _parent :-)
>>
>> I think XML -> JSON is going to be common with CouchDB whether you do
>> it with Python, Java or Erlang, it would be good (at the moment,
>> probably just for me) to reserve a top level key to facilitate XML to
>> JSON.
>>
>
> I think the more robust solution would be to have a top-level element
> in your document to hold your JSONified XML fragment. Then you can put
> anything you want in the xml member and also have room for non-xml
> metadata. Eg:
>
> {
> "_id" : "foo",
> "_rev" : "1-blah",
> "xml" : {
> "_parent" : "baz",
> "nodes" : ["etc"]
> },
> "importer" : {
> "version" : "1.1",
> "timestamp" : 123456789
> }
> }
>
Chris,
that is nice, I will change my system to use this!
thanks,
Norman
>> Norman
>>
>> On Wed, Oct 14, 2009 at 10:46 AM, Chris Anderson <jc...@apache.org> wrote:
>>> On Wed, Oct 14, 2009 at 9:43 AM, Norman Barker <no...@gmail.com> wrote:
>>>> Hi,
>>>>
>>>> I am using JSON referencing in couchdb and the input is XML (which I
>>>> am turning into JSON).
>>>>
>>>> An immediate problem is that by taking a JSON object out of CouchDB is
>>>> that you don't know the name of the corresponding XML root element.
>>>>
>>>> e.g. "RootName" : {"$ref" : "123"}, where document corresponding
>>>> object to "123" contains the child elements of RootName.
>>>>
>>>> Using private CouchDB JSON notation, similar to _id, _rev, I would
>>>> like to use _parent to specify the parent root name.
>>>>
>>>> Is this safe, is there a list of reserved words in couchdb?
>>>>
>>>
>>> All top-level keys starting with _underscore are reserved.
>>>
>>>> thanks,
>>>>
>>>> Norman
>>>>
>>>
>>>
>>>
>>> --
>>> Chris Anderson
>>> http://jchrisa.net
>>> http://couch.io
>>>
>>
>
>
>
> --
> Chris Anderson
> http://jchrisa.net
> http://couch.io
>
Re: json referencing using private member
Posted by Chris Anderson <jc...@apache.org>.
On Wed, Oct 14, 2009 at 9:52 AM, Norman Barker <no...@gmail.com> wrote:
> ok, thought so - in that case can we reserve _parent :-)
>
> I think XML -> JSON is going to be common with CouchDB whether you do
> it with Python, Java or Erlang, it would be good (at the moment,
> probably just for me) to reserve a top level key to facilitate XML to
> JSON.
>
I think the more robust solution would be to have a top-level element
in your document to hold your JSONified XML fragment. Then you can put
anything you want in the xml member and also have room for non-xml
metadata. Eg:
{
"_id" : "foo",
"_rev" : "1-blah",
"xml" : {
"_parent" : "baz",
"nodes" : ["etc"]
},
"importer" : {
"version" : "1.1",
"timestamp" : 123456789
}
}
> Norman
>
> On Wed, Oct 14, 2009 at 10:46 AM, Chris Anderson <jc...@apache.org> wrote:
>> On Wed, Oct 14, 2009 at 9:43 AM, Norman Barker <no...@gmail.com> wrote:
>>> Hi,
>>>
>>> I am using JSON referencing in couchdb and the input is XML (which I
>>> am turning into JSON).
>>>
>>> An immediate problem is that by taking a JSON object out of CouchDB is
>>> that you don't know the name of the corresponding XML root element.
>>>
>>> e.g. "RootName" : {"$ref" : "123"}, where document corresponding
>>> object to "123" contains the child elements of RootName.
>>>
>>> Using private CouchDB JSON notation, similar to _id, _rev, I would
>>> like to use _parent to specify the parent root name.
>>>
>>> Is this safe, is there a list of reserved words in couchdb?
>>>
>>
>> All top-level keys starting with _underscore are reserved.
>>
>>> thanks,
>>>
>>> Norman
>>>
>>
>>
>>
>> --
>> Chris Anderson
>> http://jchrisa.net
>> http://couch.io
>>
>
--
Chris Anderson
http://jchrisa.net
http://couch.io
Re: json referencing using private member
Posted by Norman Barker <no...@gmail.com>.
ok, thought so - in that case can we reserve _parent :-)
I think XML -> JSON is going to be common with CouchDB whether you do
it with Python, Java or Erlang, it would be good (at the moment,
probably just for me) to reserve a top level key to facilitate XML to
JSON.
Norman
On Wed, Oct 14, 2009 at 10:46 AM, Chris Anderson <jc...@apache.org> wrote:
> On Wed, Oct 14, 2009 at 9:43 AM, Norman Barker <no...@gmail.com> wrote:
>> Hi,
>>
>> I am using JSON referencing in couchdb and the input is XML (which I
>> am turning into JSON).
>>
>> An immediate problem is that by taking a JSON object out of CouchDB is
>> that you don't know the name of the corresponding XML root element.
>>
>> e.g. "RootName" : {"$ref" : "123"}, where document corresponding
>> object to "123" contains the child elements of RootName.
>>
>> Using private CouchDB JSON notation, similar to _id, _rev, I would
>> like to use _parent to specify the parent root name.
>>
>> Is this safe, is there a list of reserved words in couchdb?
>>
>
> All top-level keys starting with _underscore are reserved.
>
>> thanks,
>>
>> Norman
>>
>
>
>
> --
> Chris Anderson
> http://jchrisa.net
> http://couch.io
>
Re: json referencing using private member
Posted by Chris Anderson <jc...@apache.org>.
On Wed, Oct 14, 2009 at 9:43 AM, Norman Barker <no...@gmail.com> wrote:
> Hi,
>
> I am using JSON referencing in couchdb and the input is XML (which I
> am turning into JSON).
>
> An immediate problem is that by taking a JSON object out of CouchDB is
> that you don't know the name of the corresponding XML root element.
>
> e.g. "RootName" : {"$ref" : "123"}, where document corresponding
> object to "123" contains the child elements of RootName.
>
> Using private CouchDB JSON notation, similar to _id, _rev, I would
> like to use _parent to specify the parent root name.
>
> Is this safe, is there a list of reserved words in couchdb?
>
All top-level keys starting with _underscore are reserved.
> thanks,
>
> Norman
>
--
Chris Anderson
http://jchrisa.net
http://couch.io