cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Accessing tracked changes in ADocument DOM

ptc-1004736
1-Newbie

Accessing tracked changes in ADocument DOM

I have an ADocument (doc1) that contains XML with tracked changes. I want to copy some of the nodes from doc1 to another ADocument (doc2). In Java, I use the doc2.importNode(node) to import the nodes. Everything is copied correctly into doc2 except for the tracked changes. The resulting doc2 has the tracked changes "accepted". I need to have the tracked changes also copied over into doc2.

If aIprogramatically walk the doc1 DOM, I do not see any tracked changes in the DOM.

In all cases, I have the Editor options set to display the tracked changes highlighted.

How do I get the tracked changes to appear in the ADocument DOM structure? How can I copy a node between documents and include the tracked change markup?

4 REPLIES 4

The software is working to our specification, we don't expose tracked changes to the DOM. We have had some internal conversations about adding more information to the AOM so you could do things like this. But we have no timeline for such changes at the moment. Sorry about that.

John Dreystadt
Software Development Director
Arbortext - PTC
734-352-2835
-

Thanks. Do you recommend any alternative approaches to copy nodes between documents with tracked changes?

If you really really have to do this, my only suggestion is to save the file to a new name, munge the header information so that Editor will not open the new file with a doctype, reopen the new file without a doctype as XML markup, and then you can see the change tracking nodes. Do what you need and then throw everything away. This is painful, hard, and often fragile.

John Dreystadt
Software Development Director
Arbortext - PTC
734-352-2835
-

Hi Todd-



I suspect you'll probably have to use ACL to do this. You can "cheat" by
using the Acl AOM object to do this. You might need to do something
along these lines:



// example code, debugging left as an exercise

// also, this is javascript, translation to java left as an exercise



// assume sourceNode is the node to be copied that contains CT markup

var sourceOid = sourceNode.firstOID;

var sourceMarkup = Acl.eval("oid_content(" + sourceOid + ",0x1");



// assume caret is located in the target document where we want to

// insert the content

var targetDoc = targetNode.ownerDocument;

targetDoc.insertionPoint.insertParsedString(sourceMarkup);



HTH.



--Clay




Announcements