Home Forums General XMetaL Discussion DOMElement xml property in XMAX 5.5 Reply To: DOMElement xml property in XMAX 5.5

Derek Read

Reply to: DOMElement xml property in XMAX 5.5

This is a documentation error in the 5.5 release. The documentElement object is basically the same as the DOMElement object but specific to the root node of the document. DOMElement inherits the domNode interface which does not include an “xml” property.

The sample code that is listed for the topic you found is misleading and incorrect and the topic itself should not exist as far as I can tell. I'm guessing someone probably mistakenly duplicated (and messed up) the documentation for Document_object.xml, which provides an easy method for obtaining the xml source for the entire document as a string (but not at any level below that for which you should have a look at the previous examples I've posted in this thread). Here are the docs for Document_object.xml:

xml (Document property)
xml

Applies To
XMetaL® XMAX™ and XMetaL® Author

Access
Read only

Returns
String

Description
You can access the entire XML/SGML document (with DOCTYPE and XML PI) and store the information in a variable by using Document.xml. One example is when XMetaL is the front end of a larger solution with other applications interacting with it. For instance, in a publishing house, there are times when an author wants to preview XML or SGML documents in a third-party application. With this property, XMetaL can hand off the entire document, including the DOCTYPE, to the third party application. If you are scripting for XMetaL XMAX, see also XMetaL XMAX Document.xml.

If you want to return the entire document with Change Tracking Processing Instructions intact, see the property Document.xmlWithCT.

Usage in JScript
var strDoc = ActiveDocument.xml;

Usage in VBScript
dim strDoc = ActiveDocument.xml

Example
// XMetaL Script Language JSCRIPT:
// retrieve the entire document into a string
var doc = ActiveDocument.xml;
ActiveDocument.Host.Alert(doc);

Reply

Products
Downloads
Support