Skip to content

MergeableNode manipulation API — tree search and edit operations #63

Description

@TomProkop

Summary

Extended API for editing the form body tree (MergeableNode). Enables programmatic form manipulation without dealing with raw XML.

Tasks

  • AddControl(sectionId, control) — add control to section
  • RemoveControl(controlId) — remove control from form
  • MoveControl(controlId, targetSectionId, position) — move control between sections
  • FindNode(predicate) — generic tree search
  • FindNodesByAttribute(attrName, pattern) — search by attribute value (e.g., find all controls with datafieldname containing "vat")

Context

Today, traversing the form tree requires manual recursion:

void CollectControls(MergeableNode node, List<string> fields, string pattern)
{
    if (node.Name == "control")
    {
        var fieldName = node.GetAttribute("datafieldname");
        if (fieldName?.Contains(pattern) == true)
            fields.Add(fieldName);
    }
    foreach (var child in node.Children)
        CollectControls(child, fields, pattern);
}

This should be a first-class API on MergeableNode.

Ref: docs/roadmap.md Milestone 4.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions