Home Forums General XMetaL Discussion get processing instruction node after xml declaration tag Reply To: get processing instruction node after xml declaration tag

Derek Read

Reply to: get processing instruction node after xml declaration tag

Under normal circumstances (with an installation that has not had “application-level” macros altered) what I said previously is correct.

However, it is possible to move a Range object outside the root element provided you make modifications to the xmetal.mcr file inside the Macros folder in the installation. In that file there's an On_Update_UI event macro that forces the user's selection to stay inside the root element. Disabling that event should allow a Range to get to the PI.

I would warn against doing this however, unless you do not mind your user's putting PIs and Comments outside the root. XMetaL will still enforce “rules checking” so that elements are not allowed there.

Here's some code that will do what you are asking, provided that event macro is disabled. The way I've written this also assumes the PI is visible (not hidden by CSS) because it assumes the user's selection will be placed there at document open.

//XMetaL Script Language JScript:
var rng = ActiveDocument.Range;
if(rng.ContainerName == ".PROCINS") {
rng.SelectContainerContents();
if(rng.Text == 'dctm xml_app="Ignore"') {
Application.Alert(rng.Text);
rng.Text = 'dctm xml_app="XML Application"';
}
}

Perhaps the best place to handle this however is in the Documentum server as it is checked in or out. That should be far safer than changing this application-level macro and manipulating the document at this level on the XMetaL side. If you need assistance with that you can contact EMC.

Reply

Products
Downloads
Support