HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulehxt-9.3.1.22Haskell2010

Text.XML.HXT.Arrow.Edit

common edit arrows

  • 34 values
  • Packagehxt-9.3.1.22
  • Exports34
  • LanguageHaskell2010
  • LicenceMIT
  • SourceEdit.hs

Applies some "Canonical XML" rules to a document tree.

The rule differ slightly for canonical XML and XPath in handling of comments

Note: This is not the whole canonicalization as it is specified by the W3C Recommendation. Adding attribute defaults or sorting attributes in lexicographic order is done by the transform function of module Text.XML.HXT.Validator.Validation. Replacing entities or line feed normalization is done by the parser.

Rules: remove DTD parts, processing instructions, comments and substitute char refs in attribute values and text

Not implemented yet:

  • Whitespace within start and end tags is normalized

  • Special characters in attribute values and character content are replaced by character references

Collects sequences of text nodes in the list of children of a node into one single text node. This is useful, e.g. after char and entity reference substitution

valuexshowEscapeXml :: ArrowXml a => a n XmlTree -> a n String
#

apply an arrow to the input and convert the resulting XML trees into an XML escaped string

This is a save variant for converting a tree into an XML string representation that is parsable with Text.XML.HXT.Arrow.ReadDocument. It is implemented with xshow, but xshow does no XML escaping. The XML escaping is done with Text.XML.HXT.Arrow.Edit.escapeXmlDoc before xshow is applied.

So the following law holds

xshowEscapeXml f >>> xread == f
valueindentDoc :: ArrowXml a => a XmlTree XmlTree
#

filter for indenting a document tree for pretty printing.

the tree is traversed for inserting whitespace for tag indentation.

whitespace is only inserted or changed at places, where it isn't significant, is's not inserted between tags and text containing non whitespace chars.

whitespace is only inserted or changed at places, where it's not significant. preserving whitespace may be controlled in a document tree by a tag attribute xml:space

allowed values for this attribute are default | preserve.

input is a complete document tree or a document fragment result is the semantically equivalent formatted tree.

see also : removeDocWhiteSpace

filter for removing all not significant whitespace.

the tree traversed for removing whitespace between elements, that was inserted for indentation and readability. whitespace is only removed at places, where it's not significat preserving whitespace may be controlled in a document tree by a tag attribute xml:space

allowed values for this attribute are default | preserve

input is root node of the document to be cleaned up, output the semantically equivalent simplified tree

see also : indentDoc, removeAllWhiteSpace