General XMetaL Discussion

  • achu

    How to traverse PIs?

    Participants 2
    Replies 3
    Last Activity 11 years, 2 months ago

    I would like to traverse PIs which are generated by track changes. How to populate PIs collection? Thanks!

    Reply

    Derek Read

    Reply to: How to traverse PIs?

    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.

    Reply

    achu

    Reply to: How to traverse PIs?

    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.

    Reply

    Derek Read

    Reply to: How to traverse PIs?

    If you alter one of the Change Tracking PIs such as 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:
    "dread" time="20110603T155632-0800" data="<p>this is a test</p>"?>

    Your Custom PI:
    "dread" time="20110603T155632-0800" data="<p>this is a test</p>" 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?

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support