Hello,
  I'm creating my first BaseX based app and have a few questions about the best possible way to architect it around BaseX.

  I need to use BaseX as a service in a Tomcat container on the same server machine.  I have the following doubts:

1. I need to validate the XML coming into the database and do XSLT transformation. Should this be done in a servlet that connects to BaseX? 
2. If so, should the servlet use REST too, or is there a better way for direct connection?
3. Since BaseX is running in Tomcat context, is it possible to access it using a local client on the server machine- for debug etc on the server machine? 

  Thank you for your help.

Best regards,
Anupam