Access to XMLDOMDocument

March 26 2008

  • 1 reply.
  • This question is not yet resolved.
  • This question was started by sebdolly.
  • Last post by Carl.
sebdolly
user
26 March, 12:34
Hello,
I want to access to the object XMLDOMDocument like in the save function but outside this function, because I want to post the XML with my own application (XML is just a piece of my content). How can I do that because I don't know how retrieving the Xml DOMDocument with the object Xopus Document... ?
Carl
Xopus Team
26 March, 13:58
Hi,

You can use the Editor.setSaveXMLFunction to provide a function that does whatever you want it to do. This function will receive two arguments: the URI of the document and the XmlDocument itself. This document is a normal XML Document and not an XopusDocument. Therefore you can use selectSingleNode to get whichever part of the XML you want, and then again do whatever you like with your own application.

You can allow this function to return false, so that the save button is not updated, but you still have the document.

Another way would be to ask Editor.getActiveDocument().getXML() for the XML, and parse this with a regular domParser to get an XML document.

Editing this document, like moving a node, or updating content, will NOT have any effect on the document you are editing, because it is a clone, and not the real active document within Xopus.

If you want to make changes to this document use the Xopus Document and the API for it.

Does this anwer you question?


React

HTML will be shown as HTML code.
Linebreaks and Links starting with http:// are automatically resolved