ogma-language-xmlspec-1.12.0: Ogma: Runtime Monitor translator: XML Frontend

Safe Haskell | None
Language | Haskell2010

Language.XMLSpec.PrintTrees

Contents

- Auxiliary functions related to pretty printing XML trees.
  - Generic document constructors

Description

Print XML trees.

This variant of the function to show XML trees available in HXT is needed because of issues with values being quoted by HXT's default function.

It's based on the same ideas, but it's been implemented using the pretty-library instead of using plain string functions.

Synopsis

- flattenDoc :: Doc -> String
- class Pretty x where
  - pretty :: x -> Doc
- prettyAttr :: String -> Attributes -> Doc
- prettyContent :: XmlTree -> Doc
- prettyElemType :: String -> XmlTrees -> Doc
- prettyEntity :: String -> Attributes -> XmlTrees -> Doc
- prettyLiteralTrees :: XmlTrees -> Doc
- prettyExternalId :: Attributes -> Doc
- prettyPEAttr :: Attributes -> Doc
- prettyValue :: Attributes -> XmlTrees -> Doc
- prettyEnum :: Attributes -> Doc
- slash :: Doc
- nl :: Doc
- angles :: Doc -> Doc
- (<|>) :: Doc -> Doc -> Doc
- sepBy :: Doc -> [Doc] -> Doc

# Documentation

flattenDoc :: Doc -> String Source #

Render a document into a string.

class Pretty x where Source #

Class for values that can be converted into a document.

Methods

pretty :: x -> Doc Source #

#### Instances

Instances details

Pretty QName Source # |
Instance details Defined in Language.XMLSpec.PrintTrees Methods pretty :: QName -> Doc Source #
Pretty XmlTree Source # |
Instance details Defined in Language.XMLSpec.PrintTrees Methods pretty :: XmlTree -> Doc Source #
Pretty [XmlTree] Source # |
Instance details Defined in Language.XMLSpec.PrintTrees Methods pretty :: [XmlTree] -> Doc Source #
Pretty (String, Attributes) Source # |
Instance details Defined in Language.XMLSpec.PrintTrees Methods pretty :: (String, Attributes) -> Doc Source #
Pretty (DTDElem, Attributes, XmlTrees) Source # |
Instance details Defined in Language.XMLSpec.PrintTrees Methods pretty :: (DTDElem, Attributes, XmlTrees) -> Doc Source #

# Auxiliary functions related to pretty printing XML trees.

prettyAttr :: String -> Attributes -> Doc Source #

Pretty print an attribute followed by its value.

prettyContent :: XmlTree -> Doc Source #

Pretty print a content element.

prettyElemType :: String -> XmlTrees -> Doc Source #

Pretty print the type of an element.

prettyEntity :: String -> Attributes -> XmlTrees -> Doc Source #

Pretty print an entity.

prettyLiteralTrees :: XmlTrees -> Doc Source #

Pretty print trees as text, quoting them.

prettyExternalId :: Attributes -> Doc Source #

Pretty print an external ID.

prettyPEAttr :: Attributes -> Doc Source #

Pretty print a Parameter Entity Reference.

prettyValue :: Attributes -> XmlTrees -> Doc Source #

Given a list of attributes, pretty print the value in them.

prettyEnum :: Attributes -> Doc Source #

## Generic document constructors

slash :: Doc Source #

Forward slash character.

nl :: Doc Source #

New line character.

angles :: Doc -> Doc Source #

Enclose document in angle brackets.

(<|>) :: Doc -> Doc -> Doc Source #

Compose two documents, separating them by a new line.

The new line is not inserted if either document is empty.

sepBy Source #

Arguments

:: Doc | Separator
-> [Doc] | List of documents
-> Doc |

Concatenate a list od documents, separating them by a given separator.