Pages: 1
Print
Author Topic: How to traverse PIs?  (Read 2460 times)
achu
Member

Posts: 43


« on: June 01, 2011, 07:32:45 PM »

I would like to traverse PIs which are generated by track changes. How to populate PIs collection? Thanks!
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2570



WWW
« Reply #1 on: June 01, 2011, 10:51:05 PM »

Use these APIs for working with Change Tracking:

- AcceptAllChanges
- AcceptChange
- CanAcceptOrRejectChange
- GotoNextChange
- GotoPrevChange
- RejectAllChanges
- RejectChange
- TrackRevisions

I think that's all of them. See Programmer's Guide for details. These were really designed to allow you to provide custom UI for the end user if the two interfaces we provide (the toolbar and the dialog) don't do exactly what you need them to.

I don't think the getNodesByXPath() API can be used for Change Tracking because these PIs are a special part of the document's node tree and may not show up with that API.

If you need to make programmatic changes to these that could get very tricky. You could try walking the document using Range.GotoNext() and at each location check to see if you are in a PI node (nodetype = 7) and if so whether it has the correct target value.

Perhaps knowing what you need to do with these nodes will help me give a better answer.
« Last Edit: June 02, 2011, 12:08:13 AM by Derek Read » Logged
achu
Member

Posts: 43


« Reply #2 on: June 03, 2011, 03:05:45 PM »

We have an external program to capture line number and page number from the printing version of xml for each change. I would like to integrate this additional information to the track change PI for the further process.
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2570



WWW
« Reply #3 on: June 03, 2011, 05:04:12 PM »

If you alter one of the Change Tracking PIs such as <?xm-deletion_mark?> to include additional information that XMetaL Author itself does not insert, XMetaL may end up removing it or the Change Tracking feature (for that particular tracked change) may be broken.

If I understand you correctly, you might be hoping you can do the following?

Existing:
<?xm-deletion_mark author="dread" time="20110603T155632-0800" data="&lt;p&gt;this is a test&lt;/p&gt;"?>

Your Custom PI:
<?xm-deletion_mark author="dread" time="20110603T155632-0800" data="&lt;p&gt;this is a test&lt;/p&gt;" page="5" line="100"?>

I'm not sure what you will be doing with this additional meta-data and whether your XMetaL customization scripts would need access to it (or maybe the user needs to see it for some reason) but perhaps you could encode this information as an additional set of PIs at the start or end of the document?
« Last Edit: June 03, 2011, 05:07:39 PM by Derek Read » Logged
Pages: 1
Print
Jump to: