wcandillon/xqlint

CodeFormatter: Handling of XML nodes.

Opened this issue · 0 comments

XML nodes are not formatted yet, they are written as-is. The opening tag starts at the same
column as in the input, if the tag is put on its own line.

Example:

  let $works := <works>
      <employee name="1" />
    ...

Formats to:

let $works := 
                <works>
      <employee name="1" />
        ...

<works> is on a new line because the Expr on the right-hand-side of the LetBinding is multiline.

If we don't format XML nodes, we could e.g. put the top-level starting tag on the same position as the top-level closing tag. A problem with not formatting xml nodes is that the indentation of the XML markup in the input is (usually) written with respect to the other content, which might get formatted differently by the formatter. Indenting the surrounding code differently usually makes the XML markup look out of place.

If we format XML nodes, we need to make sure we respect the Boundary Space Policy (http://www.w3.org/TR/xquery-30/#dt-boundary-space-policy).