1

Given a tree-like computational data structure, something where every entity (except for the root entity) has exactly one parent and may have any number of children (for example, the internal structure of an XML file). How do I say correctly: You can click this button to insert an element above / on top of / before / in front of / previous the highlighted element, clicking the other button will insert it below / under / after / behind / next the selection. Insertion here is about the same hierarchical level (not children).

Further question: What is the most common term for the entities of such a tree-like data structure? Elements? Nodes? Levels? Layers? Structures? I mean: Which word, if read out a context, is most likely to explain that it is part of a data tree? Like in a sentence as: The function takes two numbers and a … and returns a string.

1
  • Generally speaking, "node", "branch", "level", and "leaf" are used for describing trees. "Element" is rarely used, and "structure" is incredibly vague and generic. And I would find "layers" to be confusing in this context.
    – Hot Licks
    Commented Mar 2, 2017 at 13:15

1 Answer 1

1

In XML as far as I can tell and HTML DOM the word is "node". And the relationship between sibling nodes uses before/previous and after/next. So: "The function takes two numbers and a node and returns a string"; "insert an element before the highlighted element"; "click here to access the next child". Look up an XML parser and read the documentation and function names to have a clearer idea.

In my experience "node" is the most common term for tree-like computational data structures but I don't think it's such a fixed terminology that you can't pick other words if you prefer, and if it makes sense in your project.

3
  • 2
    Actually, in XML (or more precisely, in the XPath language) there are preceding-sibling and following-sibling nodes, and there are preceding and following nodes. Commented Mar 2, 2017 at 12:00
  • 1
    @michael.hor257k Fair enough. I'm basing my statements on the XML::Twig parser for Perl and the XML parser in Qt. Though checking on the latter I'm reminded that it refers to "nodes" as "elements" (though I think "element" in QXmlStreamReader might be more general than just nodes ? Anyway, it illustrates that there isn't a fixed convention on this).
    – Oosaka
    Commented Mar 2, 2017 at 12:08
  • 1
    At least with XML, there is a fixed convention - it is embodied in the official XML and XPath specification documents. Commented Mar 2, 2017 at 12:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .