Reply to: Remove or replace childFebruary 20, 2013 at 6:25 pm
No idea what your DTD allows (and it isn't clear to me where you want your document to end up) but I have to assume that what your script is trying to do is just not allowed according to the DTD.
While rules checking is enabled (which is the default and something that distinguishes XMetaL from most other editors as it helps stop users from creating invalid markup) an author cannot normally insert markup that is invalid. This applies to APIs as well. See the section on “rules checking” in the Help as it describes the feature in a lot more detail than I have here.
If a script needs to transition a document (temporarily) to an invalid state there is an API named ActiveDocument.RulesChecking that will do that. Just remember to turn it back on after your script finishes and has put the document back into a valid state.