Page 1 of 1
Track Changes exist in the document
Posted: Mon Feb 01, 2010 9:00 pm
by guna@ebscohost.com
Hi,
Is there a way through api call to check, whether the existing xml document contains any tracking changes?
i checked AuthorChangeTrackingController.isTrackingChanges() method, it return true only when i check track changes is enabled in the editor.
Re: Track Changes exist in the document
Posted: Tue Feb 02, 2010 10:23 am
by Radu
Hi,
The
AuthorChangeTrackingController for the moment only contains API to toggle change tracking
On and
Off (the same action which is available on the toolbar).
There is a workaround which you can use:
Code: Select all
AuthorElement rootElement = authorAccess.getDocumentController().getAuthorDocumentNode().getRootElement();
boolean isTrackChanges = authorAccess.getChangeTrackingController().isTrackingChanges();
if(isTrackChanges){
//Toggle change tracking off so that the created document fragment contains all changes
authorAccess.getChangeTrackingController().toggleTrackChanges();
}
//The document fragment contains all track changes if change tracking is OFF.
AuthorDocumentFragment frag = authorAccess.getDocumentController().createDocumentFragment(rootElement, true);
boolean hasChanges = frag.getChangeMarks() != null && frag.getChangeMarks().size() > 0;
if(isTrackChanges){
//Toggle change tracking on again if this is the case
authorAccess.getChangeTrackingController().toggleTrackChanges();
}
Can you give us more details? Are there any more interactions which you want to make with the change tracking system?
Maybe we can improve the API to accommodate them.
Regards,
Radu
Re: Track Changes exist in the document
Posted: Thu Aug 19, 2010 11:48 pm
by guna@ebscohost.com
Hi Radu,
the above code dose on work in below mentioned scenario, can you help us to detect track changes in this scenario.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//EBSCO Publishing//DTD epNLM Editing v1.0//EN" "epnlm-edit.dtd">
<?oxy_insert_start author="CCC" timestamp="20100819T165450-0400"?>
<!--Test -->
<?oxy_insert_end?>
<article article-type="DynaDiseaseSummary" dtd-version="2.3" xml:lang="en">
<front>
</front>
<body>
</body>
</article>
Thanks
Guna
Re: Track Changes exist in the document
Posted: Fri Aug 20, 2010 9:29 am
by Radu
Hi Guna,
The code I gave you works only for change tracking highlights located inside the root element (the document fragment is created over the root element). As in your case the highlight is outside the root element, the code does not work.
To make the code work also outside the root element you can create the document fragment like:
Code: Select all
boolean isTrackChanges = authorAccess.getChangeTrackingController().isTrackingChanges();
if(isTrackChanges){
//Toggle change tracking off so that the created document fragment contains all changes
authorAccess.getChangeTrackingController().toggleTrackChanges();
}
//The document fragment contains all track changes if change tracking is OFF.
AuthorDocument doc = authorAccess.getDocumentController().getAuthorDocumentNode();
AuthorDocumentFragment frag = authorAccess.getDocumentController().createDocumentFragment(doc.getStartOffset() + 1, doc.getEndOffset() - 1);
boolean hasChanges = frag.getChangeMarks() != null && frag.getChangeMarks().size() > 0;
if(isTrackChanges){
//Toggle change tracking on again if this is the case
authorAccess.getChangeTrackingController().toggleTrackChanges();
}
Regards,
Radu