xml-conduit-1.1.0.3: Pure-Haskell utilities for dealing with XML with the conduit package.

Safe Haskell | None

Text.XML.Unresolved

Contents

- Non-streaming functions
- Lazy bytestrings
- Text
- Byte streams
- Streaming functions
- Exceptions
- Settings
  - Parse
  - Render

Description

DOM-based XML parsing and rendering.

In this module, attribute values and content nodes can contain either raw text or entities. In most cases, these can be fully resolved at parsing. If that is the case for your documents, the Text.XML module provides simplified datatypes that only contain raw text.

Synopsis

- writeFile :: RenderSettings -> FilePath -> Document -> IO ()
- readFile :: ParseSettings -> FilePath -> IO Document
- renderLBS :: RenderSettings -> Document -> ByteString
- parseLBS :: ParseSettings -> ByteString -> Either SomeException Document
- parseLBS_ :: ParseSettings -> ByteString -> Document
- parseText :: ParseSettings -> Text -> Either SomeException Document
- parseText_ :: ParseSettings -> Text -> Document
- sinkTextDoc :: MonadThrow m => ParseSettings -> Consumer Text m Document
- sinkDoc :: MonadThrow m => ParseSettings -> Consumer ByteString m Document
- toEvents :: Document -> [Event]
- fromEvents :: MonadThrow m => Consumer EventPos m Document
- renderBuilder :: Monad m => RenderSettings -> Document -> Producer m Builder
- renderBytes :: MonadUnsafeIO m => RenderSettings -> Document -> Producer m ByteString
- renderText :: (MonadThrow m, MonadUnsafeIO m) => RenderSettings -> Document -> Producer m Text
- data InvalidEventStream
  - = ContentAfterRoot EventPos
  - | MissingRootElement
  - | InvalidInlineDoctype EventPos
  - | MissingEndElement Name (Maybe EventPos)
  - | UnterminatedInlineDoctype
- def :: Default a => a
- data ParseSettings
- psDecodeEntities :: ParseSettings -> DecodeEntities
- data RenderSettings
- rsPretty :: RenderSettings -> Bool
- rsNamespaces :: RenderSettings -> [(Text, Text)]

# Non-streaming functions

writeFile :: RenderSettings -> FilePath -> Document -> IO ()

readFile :: ParseSettings -> FilePath -> IO Document

# Lazy bytestrings

renderLBS :: RenderSettings -> Document -> ByteString

parseLBS :: ParseSettings -> ByteString -> Either SomeException Document

parseLBS_ :: ParseSettings -> ByteString -> Document

# Text

parseText :: ParseSettings -> Text -> Either SomeException Document

parseText_ :: ParseSettings -> Text -> Document

sinkTextDoc :: MonadThrow m => ParseSettings -> Consumer Text m Document

# Byte streams

sinkDoc :: MonadThrow m => ParseSettings -> Consumer ByteString m Document

# Streaming functions

toEvents :: Document -> [Event]

fromEvents :: MonadThrow m => Consumer EventPos m Document

renderBuilder :: Monad m => RenderSettings -> Document -> Producer m Builder

renderBytes :: MonadUnsafeIO m => RenderSettings -> Document -> Producer m ByteString

renderText :: (MonadThrow m, MonadUnsafeIO m) => RenderSettings -> Document -> Producer m Text

# Exceptions

data InvalidEventStream

Constructors

ContentAfterRoot EventPos |
MissingRootElement |
InvalidInlineDoctype EventPos |
MissingEndElement Name (Maybe EventPos) |
UnterminatedInlineDoctype |

Instances

Show InvalidEventStream |
Typeable InvalidEventStream |
Exception InvalidEventStream |

# Settings

def :: Default a => a

The default value for this type.

## Parse

data ParseSettings

Instances

Default ParseSettings |

psDecodeEntities :: ParseSettings -> DecodeEntities

## Render

data RenderSettings

Instances

Default RenderSettings |

rsPretty :: RenderSettings -> Bool

rsNamespaces :: RenderSettings -> [(Text, Text)]

Defines some top level namespace definitions to be used, in the form of (prefix, namespace). This has absolutely no impact on the meaning of your documents, but can increase readability by moving commonly used namespace declarations to the top level.