Skip to content

Latest commit

 

History

History
124 lines (101 loc) · 1.92 KB

modop-guide.md

File metadata and controls

124 lines (101 loc) · 1.92 KB

ModOp Guide

Content

Other docs

Simple ModOps

Type add

Adds a new element at the end.

<ModOp GUID="123" Type="add" Path="/Values">
  <Maintenance />
</ModOp>

Result:

<Asset>
  <Values>
    <Standard>
      <GUID>123</GUID>
    </Standard>
    <Cost />
+   <Maintenance />
  </Values>
</Asset>

Type addNextSibling

Adds an element after the selected one.

<ModOp GUID="123" Type="addNextSibling" Path="/Values/Standard">
  <Maintenance />
</ModOp>

Result:

<Asset>
  <Values>
    <Standard>
      <GUID>123</GUID>
    </Standard>
+   <Maintenance />
    <Cost />
  </Values>
</Asset>

A common situation is when you want to insert an item at a specific position.

<ModOp GUID="123" Type="addNextSibling" Path="/Values/ConstructionCategory/BuildingList/Item[Building='1000178']">
  <Item>
    <Building>123</Building>
  </Item>
</ModOp>

Result:

<Asset>
  <Values>
    <Standard>
      <GUID>123</GUID>
    </Standard>
    <ConstructionCategory>
      <BuildingList>
        <Item>
          <Building>1000178</Building>
        </Item>
+       <Item>
+         <Building>123</Building>
+       </Item>
        <Item>
          <Building>1010372</Building>
        </Item>
        <Item>
          <Building>1010343</Building>
        </Item>
      </BuildingList>
    </ConstructionCategory>
  </Values>
</Asset>

Type addPrevSibling

Same as addNextSibling just before and not after.

Type remove

Remove selected nodes.

<ModOp GUID="123" Type="remove" Path="/Values/Cost" />

Result:

<Asset>
  <Values>
    <Standard>
     <GUID>123</GUID>
    </Standard>
-   <Cost />
  </Values>
</Asset>