Home Forums General XMetaL Discussion Xml of cloned node not proper Reply To: Xml of cloned node not proper

Derek Read

Reply to: Xml of cloned node not proper

We did not envision your usage when .xml was implemented here so this just looks like an oversight to me. I'll have development look into it.

In the meantime, I think you can use Range.TextWithRM to get what you need. Here is an example that will need to be modified to give you exactly what you want:

[code]//XMetaL Script Language JScript:
var rng = ActiveDocument.Range;
//Create a node based on current selection. If you have already defined a node object
//called “node” (as in your original script snippet) you won't need this next line.
var node = rng.ContainerNode;
//Move the rng to your node. In this example it is the same place,
//in your case it is probably a different location in the document.

If you are sure there are no revision marks, or do not want to include them you can use rng.Text instead.

For help switching between node representations of “where you are” (DOM) and Selection/Range objects see the Programmer's Guide topic “DOM interfaces” and scroll down to where it says “Working with selections and nodes”.