Home Forums General XMetaL Discussion node list issues/questions Reply To: node list issues/questions


Reply to: node list issues/questions

I'm also pretty confused about DomNodeList.
I'm trying to iterate through a node list and change the type of each element found. With my current approach, the script misses every other element, so only half of the elements in a doc get changed.

My current approach was to get inside the element's contents, then change its container name. (sorry for the horrible following formatting:)

[code]//create a Range object to manipulate
    rngText = ActiveDocument.Range;

foundTagsList = ActiveDocument.getElementsByTagName(“draft-comment”);
    for (var j=0; j < foundTagsList.length; j++){
        element = foundTagsList.item(j);
        //convert the node into a selection (using Range)
        //get the node's contents w/o containing tags
        if (rngText.CanChange(“note”)) {
          rngText.ContainerName = “note”;


background: my goal is to turn each into a certain type of so that in my PDF output, reviewers can see my questions. (I'll also later turn all those types of notes back into draft-comments)