How to get current document type

manojdcoder
Posts: 63
Joined: Thu Oct 29, 2020 12:01 am

How to get current document type

Post by manojdcoder » Wed Nov 25, 2020 7:46 pm

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

cristi_talau
Posts: 340
Joined: Thu Sep 04, 2014 4:22 pm

Re: How to get current document type

Post by cristi_talau » Wed Nov 25, 2020 11:06 pm

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.

Post Reply