我需要获得当前会话的用户名作为字符串
:
session:get-attribute('_eXist_xmldb_user')
returns this:
[auth] <account name="foobar" id="11"><group name="dba" id="1048575"><manager name="admin"/></group></user>
但是我只想要用户名,在这个例子中,是:
foobar
有办法吗?
为了在eXist-db中获得当前用户的字符串值,调用xmldb:get-current-user()
。如果用户尚未登录,则返回'guest'。
(我知道这不是你问题的答案,但它解决了你的问题)。
你试过了吗:
session:get-attribute('_eXist_xmldb_user')//account/@name