Page 1 of 1

How to get current document type

Posted: Wed Nov 25, 2020 7:46 pm
by manojdcoder
Is it possible to get current document type, whether its DITA or DocBook etc., especially from JavaScript side?

I see getDocument().documentType in AuthorEditingSupport[1] but it reads the documentType property of document always returns null

[1]https://www.oxygenxml.com/maven/com/oxy ... pport.html

Re: How to get current document type

Posted: Wed Nov 25, 2020 11:06 pm
by cristi_talau
The Document.documentType property is specified by this property: https://www.w3.org/TR/DOM-Level-2-Core/ ... -412266927 , but Web Author does not support this part of the DOM specification.

To identity the document type you can look at the document structure. For example, for DITA there is a "DITAArchVersion" attribute on the root. For DocBook, the namespace of the root element is "http://docbook.org/ns/docbook" and so on.