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.  Retrieving Child Elements.

    Posted Sun July 07, 2002 03:18 AM

    I have a schema that has an element of Author and sub elements of titles by that author. I hav a JScript to Bring back the documents, I can cycle through each Author, but do not know how to get the sub-elements. I was using the getElementsByTagName, but cannot even find that in the documenttion. Any Suggestions, or samples.


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


  • 2.  RE: Retrieving Child Elements.

    Posted Mon July 08, 2002 11:04 AM

    The getElementsByTagName() is part of the DOM implementation and the JScript API uses the Microsoft XML SDK 3.0. If you take a look at the Tamino API JScript documentation (…\Help\JScript\APIUSING.HTM#apiusing) there is a section called “Performing a Query” which contains a snippet of code making use of getElementsByTagName().

    To get the documentation for the XMLDOM implementation, go the Microsoft website and download the entire SDK including documentation. You can get to it from here.

    Hope this helps.


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


  • 3.  RE: Retrieving Child Elements.

    Posted Tue July 09, 2002 01:38 AM

    Basically my structure is that I have an Author, and then on the same document, all his titles.
    My querey brings back the correct docuement, but I am having trouble cycling through the titles for that document. I am on my way, with the docs, I think I can get it. I already have it working by altering the index in the following
    statment
    (itemSelected.getElementsByTagName(“Title”).item(1).childNodes.item(0).data);
    The item goes through the ones, but my problem now is to figure out how far I can go. If I go beyond the number of titles, I get errors (Document Required) or some such.

    The problem is that I am just learning JSCRIPT at the same time.


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


  • 4.  RE: Retrieving Child Elements.

    Posted Tue July 09, 2002 11:59 AM

    Assume you are processing documents like:-

    <?xml version="1.0"?>

    All’s Well That Ends Well
    As You Like It



    and you want to iterate through the titles, you can do something like:

    function doexample()
    {
    tc = new TaminoClient(“http://localhost/tamino/welcome3_1_1_4/ino:etc”);
    tr = tc.query (“Author”) ;
    tr = tr.DOM ;

    titles = tr.documentElement.getElementsByTagName (“Title”) ;

    txt = “” ;

    len = titles.length ;

    // build up some HTML to display titles
    for (i = 0 ; i < len ; i++)
    {
    txt = txt + titles.item(i).childNodes.item(0).text + “
    ” ;
    }
    idresults.innerHTML = txt ;

    }


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


  • 5.  RE: Retrieving Child Elements.

    Posted Wed July 10, 2002 04:26 AM

    That looks like what I needed. I had it all except the two parts to get the length of the Title section. So I am sure this will work.


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