Page 1 of 1

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

Posted: Fri Jun 01, 2012 4:23 pm
by sebastienlavandier
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

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

Posted: Fri Jun 01, 2012 4:37 pm
by Radu
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

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

Posted: Fri Jun 01, 2012 4:58 pm
by sebastienlavandier
thank you for your quick response
Bye