How to add an external entity

Having trouble installing Oxygen? Got a bug to report? Post it all here.
nithril
Posts: 12
Joined: Sun Feb 27, 2011 10:30 am

How to add an external entity

Post by nithril »

Hello,

I would like to add programmaticaly an external unparsed entity to the doctype of my document.

The only way I have found seems to manipulate docType content string and construct a new AuthorDocumentType.

Is there a easiest way ? :?:

Thanks for your help!

Regards,

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

Re: How to add an external entity

Post by Radu »

Hi Nicholas,

So you decided to use these methods:

ro.sync.ecss.ue.AuthorDocumentControllerImpl.setDoctype(AuthorDocumentType)

and:

ro.sync.ecss.ue.AuthorDocumentControllerImpl.getDoctype()

This is appropriate for what you are trying to accomplish.
The only downside (mentioned in the Javadoc) is this:
WARNING: if these modifications affect regular entities already inserted and expanded, they will not be re-parsed and their old content will remain rendered as such.
The only other approach is to use these methods:
ro.sync.exml.workspace.api.editor.WSEditorBase.createContentReader()

to read the entire XML content of the page, make modifications to it and then:

ro.sync.exml.workspace.api.editor.WSEditorBase.reloadContent(Reader)

to reload the entire Author page from the modified XML content.
But this approach will clear all undoable edits made in the document prior to the reload.

With either approach we do not have in the internal model the internal DTD subset as a structure of nodes so you have to take it as a string and return it as a string.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
nithril
Posts: 12
Joined: Sun Feb 27, 2011 10:30 am

Re: How to add an external entity

Post by nithril »

Hi Radu,

Thanks for your answer and your great support!

When debugging my program I see an obfuscated structure containing the externals entities as objects.

Do you plan to open it ? :)


Regards,
Nicolas
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to add an external entity

Post by Radu »

Hi Nicholas,

Internally we keep a map of all unparsed entities detected from the associated DTD + we keep in the internal AuthorNode tree the nodes corresponding to each entity reference in the XML document.
I am not quite sure to what objects you are referring to, maybe you can give me a screenshot with the debugger view (you can also write us directly to support@oxygenxml.com) + the exact Oxygen version on which you are developing.
These internal structures are used only for lookup, so they are read-only by nature, so you cannot modify the internal DTD in the XML by modifying any of them, the API is the only way for this, we do not have an internal structure of the entire DTD model.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
nithril
Posts: 12
Joined: Sun Feb 27, 2011 10:30 am

Re: How to add an external entity

Post by nithril »

That's too bad Oxygen doesn't have more features on internal subset manipulation. For schema where the internal subset is used to declare graphics, for my use case I will parse, add the new graphic and serialize the doctype manually.

Thanks again for your support!

Regads,

Nicolas
Post Reply