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
  • 1.  Appending a Doc

    Posted Tue November 11, 2003 07:00 AM

    I have a xml document stored in Tamino

    Craig
    Peter
    Norwood

    On the other hand I?m creating an XML doc using the DOM model which has name as it?s element. What I want to do is take the name document from the Tamino database and put it in my newly created document as an child elemet .
    I have a class that extracts the name document from tamino, and in my other class where I?m creating a new xml doc I call on the name class eg

    Document doc = db.newDocument();
    Name name= new Name();
    String nam = (String) name.extract();
    Element nameEl = doc.createElement(nam);
    Root.appendChild(nameEl);

    When I run the program I get the name document and the newly created document separately and I want the name doc to be appended as a child element to the new document.
    Can someone advice on how best can I do this .
    Thanks


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


  • 2.  RE: Appending a Doc

    Posted Tue November 11, 2003 01:50 PM

    I’ve made some progress but now have a different problem.

    I get a TResponse object from a query and get an TXMLObject by doing a getFirstXMLObject().

    Then I get a JDOM element by doing the getElement() method and casting it.

    Now I want to append this JDOM element (using the addContent method) to a element of a different, newly created JDOM document.

    I get an error

     org.jdom.IllegalAddException: The element "Organisation" could not be added as a child of "Submission": The element already has an existing parent "xql:result" 

    .

    How can I get a JDOM element from a Tamino query result without it having the parent xql:result? Is this possible?

    Thanks


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


  • 3.  RE: Appending a Doc

    Posted Tue November 11, 2003 05:44 PM

    You need to execute

    myElement = myElement.detach()

    to remove your element from its existing parent before you can attach it to another.

    Please note that this is not a Tamino API issue; it relates only to the JDOM API. Please refer to your JDOM API documentation.

    Thanks.


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


  • 4.  RE: Appending a Doc

    Posted Thu November 13, 2003 09:21 AM

    I used the


    and it worked.
    Thanks!


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