Thxs I forgot to precise it was in velocity code :-/ sorry But I found it: #set ($MyDocumentReference = $services.model.createDocumentReference($doc.wiki, 'MySpace', 'My.Dot')) I can fix my tiny patch now http://jira.xwiki.org/browse/XWIKI-10814 :-) (but Ithink getDocumentReference must be improve) 'more simple to say than to do' :-) Source: http://maven.xwiki.org/site/docs/xwiki-javadoc-5.0.x/org/xwiki/model/interna... public DocumentReference createDocumentReference(String wiki, String space, String page) Create a Document Reference from a passed wiki, space and page names, which can be empty strings or null in which case they are resolved using the resolver. Parameters: wiki - the wiki reference name to use (can be empty or null) space - the space reference name to use (can be empty or null) page - the page reference name to use (can be empty or null) ________________________________ De : Jeremie BOUSQUET <[email protected]> À : Pascal BASTIEN <[email protected]>; XWiki Users <[email protected]> Envoyé le : Mardi 19 août 2014 15h52 Objet : Re: [xwiki-users] $xwiki.getDocument don't work with dot ? Hello, If you're in a component and your objective is to get a DocumentReference, you could use the DocumentReferenceResolver instead: import org.xwiki.model.reference.DocumentReferenceResolver; // ... @Inject private DocumentReferenceResolver<String> docResolver; For the dots issue, I didn't test but I think you can escape those that should not count, like: $xwiki.getDocument("MySpace.My\.Dot") By default it would consider the last '.' dot as the space/page separator. BR, Jeremie 2014-08-19 15:06 GMT+02:00 Pascal BASTIEN <[email protected]>: Hello,
I try to obtain DocumentReference from space name and page name with getDocument(String space, String fullname) Parameters: space - Space to use in case no space is defined in the provided fullname fullname - the full name or relative name of the document to load
but is doesn't work with dot in document name...
My example: document $xwiki.getDocument("MySpace",'My.Dot').getDocumentReference() return xwiki:My.Dot rather than xwiki:MySpace.My\.Dot and document $xwiki.getDocument("MySpace",'MySpace.My.Dot').getDocumentReference() return xwiki:MySpace\.My.Dot :-/
Any idea how I can obtain DocumentReference? (use a regexp seem to be heavy way :-) )
Thxs _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users