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.


_______________________________________________
General mailing list
[EMAIL PROTECTED]
http://xqzone.com/mailman/listinfo/general

Reply via email to