Create and Update the DOCTYPE, and the ENTITY part in an Xml Document.

Questions about XML that are not covered by the other forums should go here.
sebastienlavandier
Posts: 124
Joined: Tue May 29, 2012 5:42 pm

Create and Update the DOCTYPE, and the ENTITY part in an Xml Document.

Post by sebastienlavandier » Fri Jun 01, 2012 4:23 pm

Hello,
I developed an Oxygen plugin with a customized view which contains a Swing Jpanel which offers some items. Those items can be add in a xml document by a drag and drop. It works very well.
But now, I must create and update the DOCTYPE, and the ENTITY part in the Xml Document.
I don't have find a solution in the doc.
How I can do that ?
Maybe an Oxygen API exist, or I must parsed the Xml Document with Jdom, Sax, ... ?

Do you have any ideas ?
Thanks in advance
Sébastien.L

Radu
Posts: 6714
Joined: Fri Jul 09, 2004 5:18 pm

Re: Create and Update the DOCTYPE, and the ENTITY part in an Xml Document.

Post by Radu » Fri Jun 01, 2012 4:37 pm

Hi Sébastien,

We have some API like:

Code: Select all

ro.sync.ecss.extensions.api.AuthorDocumentController.getDoctype()
which would allow you to get the DOCTYPE of the current XML file opened in the Author page.

We also have this API method which would allow you to set the DOCTYPE back to the XML:

Code: Select all

ro.sync.ecss.extensions.api.AuthorDocumentController.setDoctype(AuthorDocumentType)
Here's an example of how this would work:

Code: Select all

AuthorDocumentType dt = new AuthorDocumentType(
"article", "testSystemID", "testPublicID",
"<!DOCTYPE article PUBLIC \"testPublicID\" \"testSystemID\">");
docController.setDoctype(dt);
Basically you would take the entire content from the existing DOCTYPE:

Code: Select all

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.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

sebastienlavandier
Posts: 124
Joined: Tue May 29, 2012 5:42 pm

Re: Create and Update the DOCTYPE, and the ENTITY part in an Xml Document.

Post by sebastienlavandier » Fri Jun 01, 2012 4:58 pm

thank you for your quick response
Bye

Post Reply