Pages: 1
Print
Author Topic: Issue with Accept/Reject Change Tracking Programmatically  (Read 2790 times)
mjkhan
Member

Posts: 20


« on: June 18, 2014, 12:05:30 PM »

Hi,
I am using following code to loop over the list of track changes in XML document. The code crashes XMetaL when reading track changes which has images in it. For all other textual changes it works fine and has no problem.

  while (i++ < supplCount.length) {
        ActiveDocument.GotoNextChange();
        var strChange = Selection.TextWithRM;
        //ActiveDocument.Host.Alert(strChange);
        if (strChange.indexOf("author=\"No Change\"") > 0 && ActiveDocument.CanAcceptOrRejectChange()) {
            ActiveDocument.RejectChange();
        }
    } //while

Here is the XML snippet on which the XMetal hangs and crashes.

<?xm-deletion_mark author="Supplementation" time="20140613T112244+0100" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?>

We are using:
XMetaL Author Enterprise 8 SP1
XMetaL Author Enterprise for Documentum Version#: 4.0.0.018
XMetaL Developer 7

Any help would be very much appreciated.

Thanks
Mahmood
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #1 on: June 18, 2014, 03:30:27 PM »

I can't reproduce this issue in either 8.0.1.051 (your version) or 9.0.0.047 (current release), presumably because my test is not the same as your's because I don't have all your code.

I'm not sure how you are setting up or checking the value for supplCount.length in your while loop, so instead of doing that I'm repeatedly running the code within it, manually, over and over.

I've created the following test document based on your snippet that includes change tracking that matches your indexOf() match as well as exact copies of your snippet that do not match. The ones that match are rejected (restored to the document), the ones that don't match are left alone. No crash. Perhaps try my test to see if you can reproduce. If not then the issue is probably triggered by the code I don't have.

Code: (test DITA topic)
<?xml version="1.0"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<!-- Created with XMetaL (http://www.xmetal.com) -->
<topic id="topic_9DC27FFC40634292BCBC9256F85DD53C">
  <title><?xm-replace_text Topic Title?></title>
  <shortdesc><?xm-replace_text Short Description?></shortdesc>
  <body><?xm-deletion_mark author="No Change" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?><?xm-deletion_mark author="Supplementation" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?><?xm-deletion_mark author="No Change" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?><?xm-deletion_mark author="Supplementation" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?><?xm-deletion_mark author="No Change" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?><?xm-deletion_mark author="Supplementation" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?><?xm-deletion_mark author="No Change" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?><?xm-deletion_mark author="Supplementation" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?><?xm-deletion_mark author="No Change" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?><?xm-deletion_mark author="Supplementation" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?><?xm-deletion_mark author="No Change" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?><?xm-deletion_mark author="Supplementation" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?></body>
</topic>

Code: (test code)
//XMetaL Script Language JScript:
ActiveDocument.GotoNextChange();
var strChange = Selection.TextWithRM;
//ActiveDocument.Host.Alert(strChange);
if (strChange.indexOf("author=\"No Change\"") > 0 && ActiveDocument.CanAcceptOrRejectChange()) {
    ActiveDocument.RejectChange();
}
« Last Edit: June 18, 2014, 04:16:25 PM by Derek Read » Logged
mjkhan
Member

Posts: 20


« Reply #2 on: June 27, 2014, 01:26:52 PM »

Derek,
Can you put the following content in the <body> of the topic and try to see if the crash happens. Sometimes the cursor stops responding and when you add another element in the content is when the crash occurs. supplCount is the number of track changes within the document. So in example below you can set it 4.

<p>
<?xm-insertion_mark_start author="No Change" time="20140613T112244+0100"?>
                <image class="- topic/image " id="image_B728CD9B5CBB433694B3CD11180F92D4" placement="inline" href="dctm://devnd/0501ff8180e80979?DMS_OBJECT_SPEC=RELATION_ID"/>
  <?xm-insertion_mark_end ?>
  <?xm-deletion_mark author="Supplementation" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?>
  <?xm-insertion_mark_start author="No Change" time="20140613T112244+0100"?>
                <image class="- topic/image " id="image_B728CD9B5CBB433694B3CD11180F92D4" placement="inline" href="dctm://devnd/0501ff8180e80979?DMS_OBJECT_SPEC=RELATION_ID"/>
  <?xm-insertion_mark_end ?>
  <?xm-deletion_mark author="Supplementation" time="20140613T022244-0800" data="&lt;image class=&quot;- topic/image &quot; href=&quot;dctm://devnd/0901ff818093aa3a?DMS_OBJECT_SPEC=OBJECT_ID&quot; id=&quot;image_432E545BB9214CDD8524C528DF27F207&quot; otherprops=&quot;imageId=0901ff818093aa3a&quot; placement=&quot;inline&quot; scale=&quot;50&quot;/&gt;"?>
</p>

Thanks
Mahmood
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #3 on: June 27, 2014, 03:42:53 PM »

I do not see a crash when I run that test code against this most recent sample content.
Logged
mjkhan
Member

Posts: 20


« Reply #4 on: July 02, 2014, 09:02:29 PM »

The crash does not occur for Generic Topic. It is happening for customized Topic we have in our environment. I will open a support case to discuss it further.

Thanks!
Logged
Pages: 1
Print
Jump to:  

email us