How to get marker content
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 67
- Joined: Thu Oct 29, 2020 12:01 am
How to get marker content
Post by manojdcoder »
When a change marker is being removed, I would like to read the content of the marker. The code below gives me the plain text between the offsets, is it possible to get the actual XML content thats being removed or added by marker Or perhaps the HTML content in editor for this marker?
Code: Select all
Segment chars = new Segment();
model.getAuthorDocumentController().getChars(highlight.getStartOffset(), (highlight.getEndOffset() - highlight.getStartOffset()) + 1, chars);
data.put(RESPONSE_ATTRIBUTE_CONTENT, chars.toString());
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: How to get marker content
Post by cristi_talau »
Hello,
To get an XML representation you can use the AuthorDocumentController.createDocumentFragment() API. This returns an AuthorDocumentFragment that you can traverse and generate the XML text.
To get an HTML representation, you can use the "copy-as-html" feature, but without setting the user clipboard. This requires you to us a code as below:
Best,
Cristian
To get an XML representation you can use the AuthorDocumentController.createDocumentFragment() API. This returns an AuthorDocumentFragment that you can traverse and generate the XML text.
To get an HTML representation, you can use the "copy-as-html" feature, but without setting the user clipboard. This requires you to us a code as below:
Code: Select all
AuthorSelectionAndCaretModel selectionModel = authorDocModel.getSelectionModel();
selectionModel.moveTo(start);
selectionModel.moveTo(end, true);
AuthorClipboardObject clipboardObject = authorDocModel.getActionsSupport().handleCopy();
clipboardObject.getHtmlContent();
Cristian
-
- Posts: 67
- Joined: Thu Oct 29, 2020 12:01 am
Re: How to get marker content
Post by manojdcoder »
From the fragment, we get access to all first level AuthorNode(s), not sure how to traverse through child nodes from there. Any pointers?
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: How to get marker content
Post by cristi_talau »
Depending on the node's getType() result, you can cast it to AuthorParentNode and use getContentNodes() to access children.
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