Hi Norman, Have a look at the org-element library, which can produce an sexp representation of the structure of an org document. (In particular the function ‘org-element-parse-buffer’). You’ll need to convert the sexps to XML, but that’s a comparatively minor task.
HTH, -- Aaron Ecay