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.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  How to Print XML Object

    Posted 03/23/04 08:51 AM

    Dear all,

    If I want to print the xmlObject Content before I insert it to XML DB, the Print out result should like:







    So, what should I do?
    Following is my xmlObject DataType:

    TXMLObject xmlObject = TXMLObject.newInstance( TDOMObjectModel.getInstance());


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


  • 2.  RE: How to Print XML Object

    Posted 03/23/04 10:10 AM

    You can use the writeTo() method of the TXMLObject:

    xmlObject.writeTo(System.out);

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


  • 3.  RE: How to Print XML Object

    Posted 03/23/04 12:09 PM

    Thank you for your idea!!
    However, it seems that it only output a single line for whole xml document. What I want is to output like a “tree-like” format. So, do you have any new suggestion?


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


  • 4.  RE: How to Print XML Object

    Posted 03/23/04 01:27 PM

    Yes - you can use the older API’s static printTree() method like this:

    import com.softwareag.tamino.api.dom.TaminoClient; 
    ...
    Element myElement = (Element) xmlObject.getElement();
    TaminoClient.printTree(myElement);


    The older API is delivered in file “TaminoClient.jar”.


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


  • 5.  RE: How to Print XML Object

    Posted 03/23/04 03:10 PM

    The node content can be displayed, but it return some abnormal character instead of tag “<” “>”, how can I solve this?


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


  • 6.  RE: How to Print XML Object

    Posted 03/23/04 04:41 PM

    You probably can’t change this - the method prints a tree using plain text and ansi characters which represent the tree structure. If you want a more traditional view of your xml, try using this code (which employs xerces):

    import org.apache.xml.serialize.OutputFormat;
    import org.apache.xml.serialize.XMLSerializer;
    ..
    // Serialize the document
    Document mydoc = (Document) xmlObject.getDocument();
    OutputFormat format = new OutputFormat(myDoc);
    format.setLineWidth(65);
    format.setIndenting(true);
    format.setIndent(2);
    XMLSerializer serializer = new XMLSerializer(System.out, format);
    serializer.serialize(myDoc);


    If this doesn’t deliver exactly what you need, you could try using xalan to apply a stylesheet and print the result. Then you would have complete control over the output appearance.
    HTH


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


  • 7.  RE: How to Print XML Object

    Posted 03/23/04 05:28 PM