The arguments of InsertFragmentOperation operation

fragment

The value for this argument is a text. This is parsed by Oxygen XML Author as it was already in the document at the caret position. You can use entity references declared in the document and it is namespace aware. The fragment may have multiple roots.

Note:

You can even use namespace prefixes that are not declared in the inserted fragment, if they are declared in the document where the insertion is done. For the sake of clarity, you should always prefix and declare namespaces in the inserted fragment!

Note:

If the fragment contains namespace declarations that are identical to those found in the document, the namespace declaration attributes will be removed from elements contained by the inserted fragment.

There are two possible scenarios:

  1. Prefixes that are not bound explicitly

    For instance, the fragment:

    <x:item id="dty2"/>
    &ent;
    <x:item id="dty3"/>

    Can be correctly inserted in the document: ('|' marks the insertion point):

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE x:root [
        <!ENTITY ent "entity">
    ]>
    
    <x:root xmlns:x="nsp"> 
      |
    </x:root>

    Result:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE x:root [
        <!ENTITY ent "entity">
    ]>
    <x:root xmlns:x="nsp">
        <x:item id="dty2"/>
        &ent;
        <x:item id="dty3"/>
    </x:root>
  2. Default namespaces

If there is a default namespace declared in the document and the document fragment does not declare a namespace, the elements from the fragment are considered to be in no namespace.

For instance the fragment:

<item id="dty2"/>
<item id="dty3"/>

Inserted in the document:

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="nsp">
|
</root>

Gives the result document:

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="nsp">
    <item xmlns="" id="dty2"/>
    <item xmlns="" id="dty3"/>
</root>
insertLocation

An XPath expression that is relative to the current node. It selects the reference node for the fragment insertion.

insertPosition

One of the three constants: "Inside", "After", or "Before" , showing where the insertion is made relative to the reference node selected by the insertLocation. "Inside" has the meaning of the first child of the reference node.