Change the DOCTYPE of an Opened XML Document
Question
How to change the DOCTYPE of a document opened in the Author mode?
Answer
The following
API:
ro.sync.ecss.extensions.api.AuthorDocumentController.getDoctype()allows you to get the
DOCTYPE of the current XML file opened in the
Author mode. There is also an API method available that would allow you to set the
DOCTYPE back to the
XML:ro.sync.ecss.extensions.api.AuthorDocumentController.setDoctype(AuthorDocumentType)Here is an example of how this solution would work:
AuthorDocumentType dt = new AuthorDocumentType("article", "testSystemID", "testPublicID", "<!DOCTYPE article PUBLIC \"testPublicID\" \"testSystemID\">"); docController.setDoctype(dt);
Basically you could take the entire content from the existing DOCTYPE,
ro.sync.ecss.extensions.api.AuthorDocumentType.getContent()modify it to your needs, and create another
AuthorDocumentType object with
the new content and with the same public, system IDs. For example, you could use this API is you want to add unparsed entities in the XML
DOCTYPE.