Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2554

Debugger infoset output is confusing with hidden groups

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 3.2.0
    • Debugger
    • None

    Description

      When the CLI debugger outputs the infoset with the "info infoset" command, it defaults to showing hidden groups. This is useful when debugging since you usually want to see everything that happens during parse, even if it won't end up in the final infoset.

      But when outputting complex types that are completely hidden we get things that look like this:

      <f>
        <h>
          <f xmlns="">2</f></h></f>
      

      Note how the closing tags are not on a newline. This isn't too bad, but when infosets get big it becomes hard to read.

      I think the underlying issues is that the XMLTextInfosetOutputter uses "hasVisibleChildren" to determine when we should output newlines when end complex elements. If a complex element has no visible children (either because there are no children or because they are all hidden), then this causes us to output <foo></foo> without a newline. This is the expected behavior.

      We probably want to keep this behavior but need to change how we figure out when to output newlines. This is because an element might not have any visible children, but they will still be output by the debugger, so there are visible children from the debuggers perspective and so we need newlines.

      So I think we first want to get rid of hasVisibleChildren completely. It's only used by the XMLTextInfosetOutputter, so we can just need adjust that class to keep track of the logic. And I think we can do so by just adding a single mutable member variable to the class, something like:

      var currentComplexElementHasChildren: Boolean = false
      

      When startComplex is called, we always set this variable to false, since this is the current complex and we don't know yet if it has children.

      When startSimple is called, we always set this variable to true, since we now know the current complex has at least one child.

      When endComplex is called, we output a newline only if the variable is true. Additionally, we then always set the variable to true. This is because if we are ending a complex, that means all parent complex elements must have children (because this complex element we are ending is a child of all those parent complex elements). This will ensure when all parent complex elements output newlines when they too are ended.

      Attachments

        Activity

          People

            slawrence Steve Lawrence
            slawrence Steve Lawrence
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: