Inserting Processing instruction
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 240
- Joined: Wed Jun 17, 2015 12:46 pm
Inserting Processing instruction
Hello,
I am using the Oxygen 21.1.0.2 SDK and I would like to insert a processing instruction inside my AuthorDocument through an operation.
The final objective is to be able to insert this kind of fragment:
If it's not possible to insert the whole fragment at once, I tried to insert only :
but it failed.
How to do that insertion ?
Thanks,
Johann
I am using the Oxygen 21.1.0.2 SDK and I would like to insert a processing instruction inside my AuthorDocument through an operation.
The final objective is to be able to insert this kind of fragment:
Code: Select all
<myElement>
<description>myDescription</description>
<?PITarget id="1" ?>
<?PITarget id="2" ?>
</myElement>
Code: Select all
<?PITarget id="1" ?>
How to do that insertion ?
Thanks,
Johann
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Inserting Processing instruction
Hi Johann,
Maybe you could give us more details, tell us what API you tried for insertion, maybe give a small sample java code and also tell us what error Oxygen reported upon insertion.
In general to insert an XML fragment you should use the API ro.sync.ecss.extensions.api.AuthorDocumentController.insertXMLFragment(String, int).
Regards,
Radu
Maybe you could give us more details, tell us what API you tried for insertion, maybe give a small sample java code and also tell us what error Oxygen reported upon insertion.
In general to insert an XML fragment you should use the API ro.sync.ecss.extensions.api.AuthorDocumentController.insertXMLFragment(String, int).
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 240
- Joined: Wed Jun 17, 2015 12:46 pm
Re: Inserting Processing instruction
Hello Radu,
It's exactly what I tested :
and it returned me :
Same result for this test :
If I remove the PI, it obviously works.
Regards,
Johann
It's exactly what I tested :
Code: Select all
String myFragment = "<myElement><description>myDescription</description><?PITarget id=\"1\" ?><?PITarget id=\"2\" ?></myElement>";
authorAccess.getDocumentController().insertXMLFragment(myFragment, authorAccess.getEditorAccess().getCaretOffset());
Code: Select all
Could not insert document fragment. Cause: ro.sync.ecss.dom.db cannot be cast to ro.sync.ecss.extensions.api.node.AuthorElement
Code: Select all
String myFragment = "<?PITarget id=\"1\" ?>";
authorAccess.getDocumentController().insertXMLFragment(myFragment, authorAccess.getEditorAccess().getCaretOffset());
Regards,
Johann
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Inserting Processing instruction
Hi Johann,
I cannot reproduce this problem on my side. Where is the caret placed when the code is invoked? Is it inside an element?
After the error is reported in the Oxygen results view, can you right click it, choose "Show message" and then in the dialog which shows up there should be a "More details..." link which when pressed should show you a Java exception stack trace. Can you paste that stack trace in a reply on this thread?
Are you using our AuthorDocumentFilter API? If so, please make sure the exception is not thrown in your own code.
Regards,
Radu
I cannot reproduce this problem on my side. Where is the caret placed when the code is invoked? Is it inside an element?
After the error is reported in the Oxygen results view, can you right click it, choose "Show message" and then in the dialog which shows up there should be a "More details..." link which when pressed should show you a Java exception stack trace. Can you paste that stack trace in a reply on this thread?
Are you using our AuthorDocumentFilter API? If so, please make sure the exception is not thrown in your own code.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 240
- Joined: Wed Jun 17, 2015 12:46 pm
Re: Inserting Processing instruction
Hello Radu,
You were right. A Class cast exception was not well catched on our side (in a CustomDocumentFilter)... We considered AuthorNodes only as AuthorElements... This is no longer the case with the processing instructions.
My bad !
Thanks for your help,
Johann
You were right. A Class cast exception was not well catched on our side (in a CustomDocumentFilter)... We considered AuthorNodes only as AuthorElements... This is no longer the case with the processing instructions.
My bad !
Thanks for your help,
Johann
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service