Hi, Le 21/09/2009 15:53, Torgeir Veimo a écrit : > 2009/9/21 Philipp Bunge <[email protected]>: > >>> Why not >>> >>> >>>> myblog/what_i_learned_today >>>> myblog/iphone_shipping >>>> myblog/iphone_shipping/foo:comments/i_like_it_too >>>> myblog/iphone_shipping/foo:comments/i_like_it_too/i_hate_it >>>> >> Jep, that's fine too. I just copied the example from DavidsModel on >> the Wiki [1] and prepended the namespace where I would use it. >> >> My question was more on the line of when to use a namespace prefix and when >> not. >> > > Use prefixes for operational properties, and none for value > properties. The former properties might eventually end up in a schema. > I generally use a namespace when: - i want to separate properties/nodes of unrelated content and to iterate over a set properties simply by using: node.getProperties("foo:*"); node.getNodes("foo:*"); - i do not control the property name (set by the user) and i do not want collision with existing properties without namespace. - i could have a property and a child node with the same (local) name. - i want to optimize a search of a node having a specific property (@foo:title will result in better relevant matches than @title).
I generally do not use a namespace when: - i want to expose parts of the path of a node in a URI on a web server (a prefix: is not very sexy ;)). - i know there will be only one kind of child node below a node. Using a namespace from the start can also be useful for migration because you can then distinguish a node/property created with old http://foo/1.0 namespace and the new http://foo/2.0 in order to manage them differently. -- Sébastien Launay
