joewiz
6/2/2017 - 11:13 PM

Notes on factors that influence whitespace in XQuery, with a focus on eXist 3.x

Notes on factors that influence whitespace in XQuery, with a focus on eXist 3.x

Notes in preparation for a blog post or article.

Factors

Takeaways

  • Be explicit and conscious of whitespace in source documents, especially in mixed content
  • If using in-memory nodes, be conscious of boundary-space default setting, strip
  • Be conscious of default indent settings. If boundary-space strip and serializer indent=yes this can make a document appear as if it has whitespace, when it really doesn't
  • indent=yes can introduce whitespace; saving a document back into the database can result in extra whitespace

Remaining questions

  • Does indent=no ever completely strip whitespace where it was, or does it just collapse whitespace to a single character?
  • Does indent=yes ever insert whitespace where there wasn't any, or does it just expand existing whitespace?
  • What role does the indexer's whitespace settings (suppress-whitespace=leading|trailing|both|none or preserve-whitespace-mixed-content=yes|no) play? Under what scenarios does it affect the results of a query?
  • What role does the parser play? Presumably none, except for resolving entities?