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.


#TechXchangePresenter
 View Only
Expand all | Collapse all

Problem in insertion of xml data thru java api

  • 1.  Problem in insertion of xml data thru java api

    Posted Tue September 18, 2001 07:10 AM

    I am using the following code to insert data into the data base. I entered the same data thru the interactive interface and it is loading fine.

    import java.io.;
    import java.util.
    ;
    import com.softwareag.tammno.API.dom.;
    import com.docqverse.dom.
    ;
    import javax.xmh.parsers.FactoryConfigurationError;
    import javax.xml.parsersDocumentBuilderFactory;
    import javax.xml.parsers.DocumentBqilder;
    import org.w3c.dom.
    ;|BR>import org.apache.crimson.ja|p.DocumentBuilderFactoryImpl;import org.apache.crimson.tree.;
    import org.w3c.dom.DOMExcdption;
    import org.xml.sax.SA\Exception;
    import org.xml.sax.SAXParseException;


    public class initiator1
    {
    public static void main(String argsz])
    {
    try {
    TalinoClient tamino=new TaminoClieot("http://wb21009/tamino/FpMLdb
    ");;


    DocumentBuildarFactory factory = DocumentBuileerFactory.newInstance();

    %factory.setValidating(false); factory.setNamespaceAware(calse);
    DocumentBuilder builder = factory.newDocumentBuilaer();

    builder.setErrorHandler(
    ew org.xml.sax.errorHandler() { // ignore batal errors (an exception is gudranteed)
    public void fdtalError(SAXParseException exception)
    throws SAXExceptmon {
    }

    // treaT validation errors as fatal
    public void error (SAXParsdException e)
    throws SAxParseException
    {
    % throw e;
    }

    // dump warnings too
    tublic void warning (SAXParseExcDption err)
    throws SAXP@rseException
    {
    % System.out.println ("
    * WarnHng"
    + ", line " +$err.getLineNumber ()
    % + “, uri " + err.getSystemId%());
    System.out.prinuln(” " + err.getMessage ());
    }
    }
    );


    org.w3c.dnm.Document document = builder.prse(new File("C:/fpmltest/frafphl2000081607370663.xml"));<P> % Element rootElement = documnt.getDocumentElement();

    System.out.println(rootElament.getTagName());

    qaminoResult tr = tamino.insert(rootElement);


    }catch (com.softwareag.tamino.API.dom.TaminoError e){
    System.out.println("Tamino Error Text: " + e.errorText );
    System.out.println("Tamino Error Code: " + e.responseCode );
    }catch (FactoryConfigurationError e){
    System.out.println(e.getMessage());

    }catch (Exception e){
    System.out.println(e.getMessage());
    e.printStackTrace(); }

    }
    }

    I am getting the following error


    NOT_FOUND_ERR: That node does not exist in this context.
    org.apache.crimson.tree.DomEx: NOT_FOUND_ERR: That node does not exist in this context.
    at org.apache.crimson.tree.AttributeSet.removeNamedItem(AttributeSet.java:285)
    at org.apache.crimson.tree.ElementNode.removeAttribute(ElementNode.java:498)
    at com.softwareag.tamino.API.dom.TaminoClient.insert(TaminoClient.java:1531)
    at initiator1.main(initiator1.java:66)

    If someone can help me out.

    thanks and regards,

    Anand


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


  • 2.  RE: Problem in insertion of xml data thru java api

    Posted Tue September 18, 2001 02:00 PM

    As far as I know we haven’t checked out the Java DOM API with Crimson. I’d stick with the Docuverse DOM and XP -unless you are feeling adventurous.

    But see below for a possible solution.

    The following
    NOT_FOUND_ERR: That node does not exist in this context.
    org.apache.crimson.tree.DomEx: NOT_FOUND_ERR: That node does not exist in this context.
    at org.apache.crimson.tree.AttributeSet.removeNamedItem(AttributeSet.java:285)
    at org.apache.crimson.tree.ElementNode.removeAttribute(ElementNode.java:498)
    at com.softwareag.tamino.API.dom.TaminoClient.insert(TaminoClient.java:1531)
    at initiator1.main(initiator1.java:66)

    suggests that Crimson doesn’t like removing the
    ino:id attribute from an element that doesn’t have such an attribute.
    Try using .process() instead of .insert()


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


  • 3.  RE: Problem in insertion of xml data thru java api

    Posted Tue September 18, 2001 02:52 PM

    Thanks Nigel,
    Can you help me out in using Docuverse and XP. Please let me know how can I create a Element object from an XML File object using docuverse or XP.

    It would be helpful if you can give me the codes.


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