Unfortunately the result sequence sent by the server simply doesn't contain
this information; you might consider obtaining the type yourself, using the
xdmp:node-kind builtin, and including that information in the result, possibly
by wrapping a special element around attribute nodes:
xdmp:node-kind($x) = "attribute") then <attribute-node>{ $x }</attribute-node>
else $x
This also has the benefit of making the attribute name available on the client.
On Mar 1, 2010, at 11:19 AM, Lee, David wrote:
Thanks !
In my use case, any kind of method to accurately determine the Xdm type of
results would be good enough, even if full attribute (XdmAttribute) support
wasnt implemented. I I could only 'know' an item was an attribute then I can
serialize it with the current implementation (I've tested
ResultItem.writeTo( outputStream ) and it writes the value of
the attribute just fine).
So just knowing the XDM type would be sufficient for me.
Thanks for noting this issue.
-David Lee
From:
[email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Sam Neth
Sent: Monday, March 01, 2010 1:51 PM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] Bug in XCC - lone attributes reportingas
elements.
This would be the appropriate place to report a bug or RFE, assuming no support
contract is in place. In this case, the behavior you describe is a known
limitation of XCC which we are already tracking as an RFE. You may consider
your interest noted.
On Mar 1, 2010, at 5:46 AM, Lee, David wrote:
Whats the best way to report this bug ?
If I run an ad-hoc query in XCC which returns a single attribute, for example :
attribute {"foo"} {"bar"}
The resulting item in XCC is reporting itself as an element, but (of course)
wont serialize.
I would like to be able to detect lone attributes for special handling but I
cant because XCC is incorrectly representing them as Elements
Example code fragment:
while (rs.hasNext()) {
ResultItem rsItem = rs.next();
ItemType type = rsItem.getItemType();
XdmItem item = rsItem.getItem();
if( (type.isNode() && item instanceof XdmAttribute) )
// FAILS TEST ... item is an ElementImpl not
an XdmAttribute
---
item ElementImpl (id=62)
stream null
stringVal "bar" (id=73)
type NodeType (id=58)
----------------------------------------
David A. Lee
Senior Principal Software Engineer
Epocrates, Inc.
[email protected]<mailto:[email protected]>
812-482-5224
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general