On Wed, Mar 7, 2012 at 8:35 PM, David Buchmann <[email protected]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > hi, > > while implementing the jackalope php jsop client for the jackrabbit > backend, i stumbled over a problem with the json returned when a > property and a child node have the same name: > > the repository is something like this: > <test toast="bar"> > <toast/> > </test> > > to create it, i do > > Session s = repository.login(credentials,workspace); > Node n = s.getRootNode().addNode("test"); > n.setProperty("toast", "bar"); > n.addNode("toast"); > s.save(); > > now the json returned for /test looks like this: > > {"toast":"bar",":jcr:primaryType":"Name","jcr:primaryType":"nt:unstructured","toast":{}} > > > note: there is twice the key "toast". as far as i understand json, this > is not valid. the php function json_decode just overwrites the property > "toast" => "bar" with the node array "toast" => array(). javascript json > parsers tend to do the same. > > is jackrabbit using a custom json parser that can handle same-name keys? > are there any plans to make this valid json? > > or would the jcr spec forbid it? found nothing about it. when looking at > the xml representation, it sounds totally normal. when outputting i.e. > the path of the property and the node it looks strange.
as of jcr 2.0 properties and child nodes may share the same namespace [0]. cheers stefan [0] http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#3.4.2.2 Child Resolution > > thanks for input, > david > - -- > Liip AG // Agile Web Development // T +41 26 422 25 11 > CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAk9XuHIACgkQqBnXnqWBgIss8QCgvUFwzFLURDtdRSXHrdrboCuu > AwIAoMNJSL0VwGfjxfDJy6c87k/5gbj5 > =fe9h > -----END PGP SIGNATURE-----
