IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  getting XML from tamino for transformation

    Posted Wed May 30, 2007 06:57 PM

    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


    #webMethods-Tamino-XML-Server-APIs
    #webMethods
    #API-Management


  • 2.  RE: getting XML from tamino for transformation



  • 3.  RE: getting XML from tamino for transformation

    Posted Thu June 07, 2007 04:13 PM

    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!


    #API-Management
    #webMethods
    #webMethods-Tamino-XML-Server-APIs


  • 4.  RE: getting XML from tamino for transformation

    Posted Wed June 13, 2007 06:08 AM

    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? :?


    #webMethods-Tamino-XML-Server-APIs
    #webMethods
    #API-Management


  • 5.  RE: getting XML from tamino for transformation

    Posted Wed June 13, 2007 11:43 AM

    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


    #webMethods-Tamino-XML-Server-APIs
    #API-Management
    #webMethods