[MarkLogic Dev General] .NET XCC
Wyatt
marklogic at wylovan.com
Mon Aug 14 19:54:16 PDT 2006
Greetings all,
I've been playing with the .NET version of the XCC package and have run
into an obstacle I can't seem to surmount. Maybe a bug - more likely my
own ignorance...
I'm trying to write a C# (VS 2005) function that utilizes XCC to execute
an arbitrary XQuery and return a string of well-formed XML. All is well
if the XQuery happens to return a single element, but I'm running into
trouble post processing it if it is not. It appears that
NodeType.ToString() always returns "element()"
I've been using the XdmItem as so...
//--
private string ProcessResults(ResultSequence rs) {
StringBuilder sb = new StringBuilder();
while (rs.HasNext()) {
XdmItem xi = rs.Next().Item;
if (xi.ItemType.Node) {
sb.AppendLine(((NodeType)xi.ItemType).ToString());
}
else if (xi.ItemType.Atomic) {
sb.AppendLine(((AtomicType)xi.ItemType).ToString());
}
}
return sb.ToString();
}
//--
The XdmItem.ItemType seems to accurately resolve what is a Node and what
is an Atomic, and ToString() correctly returns "xs:string" for an atomic
string (didn't try any others), BUT when it is a Node ToString() always
returns "element()" even it is an attribute node??? I'd have thought it
would return "attribute()"?
Any help would be much appreciated.
More information about the General
mailing list