webMethods

webMethods

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
Expand all | Collapse all

joining documents into one big document

  • 1.  joining documents into one big document

    Posted Thu September 28, 2006 04:40 PM

    I would like to put the result documents of my query in one document with root element “Trefferliste.”

    The line

    root = (Element)obj.getDocument();

    is not working. How can I integrate the documents?

    TResponse tresp=sendQuery(query, tacc);
    
    Document doc = new Document();
    Element root=new Element("TrefferListe");		
    TXMLObjectIterator ti = tresp.getXMLObjectIterator() ;
    TXMLObject obj;
    
    
    while(ti.hasNext())
    {
    obj = ti.next();
    root = (Element)obj.getDocument();
    }
    
    
    doc.setRootElement(root);

    [/code]


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


  • 2.  RE: joining documents into one big document

    Posted Thu September 28, 2006 05:08 PM

    I assuming you are using JDOM. Firstly you should use getElement() rather than getDocument(). Then within your iterator body instead of

       root = (Element)obj.getDocument();

    code something like:

       newElem = (Element)obj.getElement();
    newElem = (Element)newElem.detach();
    root.addContent(newElem);

    Hope this helps.


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


  • 3.  RE: joining documents into one big document

    Posted Thu September 28, 2006 05:32 PM