Not sure whether i am doing this right as i couldn't find good documentation.
But i have an existing XML document created using the DOM parser and i was hoping the write-xml function could write into this e.g.
TEMP-TABLE tt-getTenancyDetails:WRITE-XML("handle", lv-TenanciesNode, FALSE, ?, ?, FALSE, FALSE).
Where lv-TenanciesNode is a DOM X-NODEREF.
However it doesn't write the data into the node but there is no error is this because WRITE-XML is the SAX parser?
WIill i have to write the XML into a longchar and then load that into a DOM X-DOC and then use that instead to insert the xml into my DOM tree?
Robin is correct.
The documentation is not very clear but you need to create a node in our document to attach the contents of the WRITE-XML to and then append that document to your already created document e.g.
/* o-doc is my existing XML document */
/* lv-TempNode is created here as a node of o-Doc */
/* Parent node created here as a child node of o-Doc. */
/* This the temp store from the Import-node data */
DATASET HS_myDataSet:WRITE-XML("HANDLE", lv-TempNode, FALSE, ?, ?, FALSE, FALSE).
/* Append the temp node that has the DATASET to our parent node */
/* The dataset is now in o-Doc as a child of lv-ParentNode */
WRITE-XML will not append to existing data in the X-NODEREF. It will delete the existing data and then write the temp-table data to the X-NODEREF. You should be able to use WRITE-XML to an X-NODEREF, then insert it into your DOM tree. If that is not the case, then I'd call it a bug.