getting XML from tamino for transformation

Hello,
I just tried to get an XML out of tamino in order to later transform it
via XSLT to html. First, to get the XML via query, I tried following
code:



TaminoDataAdapter adapter = new TaminoDataAdapter(this.url, collection);
        adapter.Behavior = TaminoAdapterBehavior.ReadOnly;


TaminoDataAdapter adapter = new TaminoDataAdapter(this.url, collection);
        adapter.Behavior = TaminoAdapterBehavior.ReadOnly;

        DataSet ds = new DataSet();
        TaminoQuery tamQuery = new TaminoQuery("input()" + query);
        int count = adapter.Fill(ds, tamQuery);

        XmlDocument xdoc = new XmlDocument();
        ds.WriteXml("c:/test.xml");
        xdoc.LoadXml(ds.GetXml());

This fills a dataadapter, which contens is later returned as an XmlDocument.
So far, this is working. But the problem is, that the Xml-document
is not in its original form, it looks like this:


<NewDataSet>
<Taxonomie>
<Wert>1</Wert>
<Bezeichnung>Wissen</Bezeichnung>
<Beschreibung>bla bla bla... </Beschreibung>
</Taxonomie>
....
....
</NewDataSet>

But, in order to parse it via XSLT, it should look like this:


<?xml version="1.0" encoding="utf-8"?>
<xq:Result .....>
<Bezeichnung>Wissen</Bezeichnung> 
<Beschreibung>bla bla bla... </Beschreibung>
</Taxonomie>
...
</xq:Result>

So is there a way to get the XML out of tamino in a way it has the xq:Result tag in it?
I have also tried this:

[code]

TaminoQuery query = new TaminoQuery(queryString);
// DB-Verbindung definieren
TaminoConnection con = new TaminoConnection(url);
// Verbindung

Did you have a look at TaminoCommand.QueryReader/QueryStream?

http://techcommunity.softwareag.com/ecosystem/documentation/crossvision/ins441/dotnetapi/proc_results.htm

Thanks for the answer, and sorry for my delay, I was a few days off development. Will try now, looks promising and I guess it is going to work!

So far, I’ve been experimenting around quite a bit, and tried to
build myself a method which should return an XpathDocument
for later transformation.


public XPathDocument GetXPathDocFromQuery(string collection, string queryString)
        {
                         
                TaminoQuery query = new TaminoQuery(queryString);
                TaminoConnection con = new TaminoConnection(this.url);
                con.Open(TaminoConnectionMode.AutoCommit);
                
                TaminoCommand cmd = con.CreateCommand(collection);
               
                XmlReader reader = cmd.QueryReader(query);
                XPathDocument xpathDoc = new XPathDocument(reader);
                                                                
                return xpathDoc;
            
        }

And later the following transformation with the xpathDoc I get from the method above.


public string Dom_XSLT(XPathDocument xpathDoc, XslCompiledTransform xslt)
        {
           
            StringWriter outWriter = new StringWriter();
            xslt.Transform(xpathDoc, null, outWriter);
            string outString = outWriter.ToString();
            return outString;
            
            // xslTransform.Transform(xpathDoc, null);
        }

The returned string I use to output directly on a webpage. Still, I am
getting my XSLT from a file. Later, I want to store XSLT in Tamino too,
and get these files out there in a similiar way.
Fact is, that if I get BOTH the XML and XSLT from a file this way


string strXMLFile = Server.MapPath(@"XML\taxonomie.xml");
XPathDocument xpTaxonomie = new XPathDocument(strXMLFile);

The transformation works perfectly. It still does not work at all if I try
to get the XPathdocument out of the Database directly.
I still don’t have the slightest idea how to fix this…

I just want to get out parseable XML and XSLT files stored in tamino,
Does anybody who did this before have a clue? :?

It is possible that you may be better off inserting/retrieving complete XML documents. The following link should help with this. It is normally best if you assign a document name for your documents. You will also need to provide schemas for the documents too - unless you use the ino:etc collection (which is only recommended for test purposes).

http://techcommunity.softwareag.com/ecosystem/documentation/crossvision/ins441/dotnetapi/crud.htm