Do you want to do anything interesting with the result of the fetch or really “just write the resulting XML to standard output”?
Regardless, you need to do a few things:
1) create a class to represent your documents and/or elements that implements the TSAXElement and TSAXDocument interface. These will be instantiated by your element handler.
2) create an element handler class to handle the sax events - an element handler that extends TSAXElementDefaultHandler. In this class, you will probably need an array (ArrayList) to hold the result set of objects (instances of the things defined in step 1 above); the “getFirstElement()” and “getElementIterator()” will refer to this.
Your element handler will implement the SAX event methods - startElement(), endElement(), and characters() being the most interesting.
Now instantiate an element handler and create a new TSAXObjectModel with it and register that using TXMLObjectModel.register(). Set this as your object model on your TXMLObjectAccessor.
Then when you query with this accessor, your event handler methods will be called, you can instantiate your element instances in startElement(), and add them to the result list in endElement(). The trick is maintaining context when handling even moderately complicated documents.
However, if you just want to spew the XML to stdout, you can just println() the arguements to your element handler methods - but I doubt you’re really writing a program to do this (use a web browser like lynx if that’s really what you want).
I hope this is helpful. The whole sax API is pretty opaque (imo).
#API-Management#webMethods-Tamino-XML-Server-APIs#webMethods