Implementing Smart Paste for my own document type
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 22
- Joined: Fri Aug 09, 2013 11:03 am
Implementing Smart Paste for my own document type
Hi guys,
I have my own document type (based on an XSD schema); the schema includes html-style formatting tags for lists, bold, italics, paragraphs and such.
I'd like to implement smart paste so that docs from Word can retain this kind of formatting, but I'm not clear on whether I need to implement AuthorSchemaAwareEditingHandlerAdapter, or if there is a non-Java way of doing that? Maybe tweaks in the schema to allow the existing smart paste implementation to work?
Any lead / example / code sample welcome.
Thanks a lot,
Yannick
I have my own document type (based on an XSD schema); the schema includes html-style formatting tags for lists, bold, italics, paragraphs and such.
I'd like to implement smart paste so that docs from Word can retain this kind of formatting, but I'm not clear on whether I need to implement AuthorSchemaAwareEditingHandlerAdapter, or if there is a non-Java way of doing that? Maybe tweaks in the schema to allow the existing smart paste implementation to work?
Any lead / example / code sample welcome.
Thanks a lot,
Yannick
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Implementing Smart Paste for my own document type
Hi Yannick,
You would need to also write some Java code to handle this.
First of all, smart paste is based on the fact than when you copy content in an application like MS Word it also sets in the clipboard an HTML translation of the copied content. So Oxygen actually interprets this HTML content from the clipboard using XSLT stylesheets to convert it to its target XML vocabulary.
Let's discuss for example how smart pasting works in XHTML document type for example (as it is probably closer to what you need).
If in the Oxygen Preferences->Document Type Association page you edit the XHTML document type, in the Classpath list there are references to the xhtml.jar containing Java extensions and to a resources folder containing the XSLT stylesheets which are used for conversion. In the same dialog in the XHTMLExtensionsBundle tab there is an extension configured called XHTMLExtensionsBundle which is implemented in the xhtml.jar.
If you download our Author SDK:
http://www.oxygenxml.com/oxygen_sdk.htm ... horing_SDK
you will have in it the Java code for the XHTMLExtensionsBundle implementation.
That code instantiates a class called XHTMLExternalObjectInsertionHandler for which Java sources are also present. On the method XHTMLExternalObjectInsertionHandler.getImporterStylesheetFileName(AuthorAccess) the code returns xhtml2xhtml.xsl which means that this XSLT:
OXYGEN_INSTALL_DIR\frameworks\xhtml\resources\xhtml2xhtml.xsl
will be called to process the HTML content set in the clipboard by MS Word and return the translated XML content to be inserted at the caret position in the Author mode.
Regards,
Radu
You would need to also write some Java code to handle this.
First of all, smart paste is based on the fact than when you copy content in an application like MS Word it also sets in the clipboard an HTML translation of the copied content. So Oxygen actually interprets this HTML content from the clipboard using XSLT stylesheets to convert it to its target XML vocabulary.
Let's discuss for example how smart pasting works in XHTML document type for example (as it is probably closer to what you need).
If in the Oxygen Preferences->Document Type Association page you edit the XHTML document type, in the Classpath list there are references to the xhtml.jar containing Java extensions and to a resources folder containing the XSLT stylesheets which are used for conversion. In the same dialog in the XHTMLExtensionsBundle tab there is an extension configured called XHTMLExtensionsBundle which is implemented in the xhtml.jar.
If you download our Author SDK:
http://www.oxygenxml.com/oxygen_sdk.htm ... horing_SDK
you will have in it the Java code for the XHTMLExtensionsBundle implementation.
That code instantiates a class called XHTMLExternalObjectInsertionHandler for which Java sources are also present. On the method XHTMLExternalObjectInsertionHandler.getImporterStylesheetFileName(AuthorAccess) the code returns xhtml2xhtml.xsl which means that this XSLT:
OXYGEN_INSTALL_DIR\frameworks\xhtml\resources\xhtml2xhtml.xsl
will be called to process the HTML content set in the clipboard by MS Word and return the translated XML content to be inserted at the caret position in the Author mode.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
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