documentToXMLString from Java service


I’m updating an existing Java service that takes either an XML Node or Document as an argument for processing and now need to convert it to a string.

I know that this can be done by using a Service.doInvoke to one of the documentToXMLString (and potentially other XML services) but wondered if it was possibly to serialise the Node/Document Java objects directly in code?

Many thanks,