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

Safe Haskell | None
Language | Haskell2010

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 :: forall (m :: Type -> Type) o. MonadThrow m => ParseSettings -> ConduitT Text o m Document
- sinkDoc :: forall (m :: Type -> Type) o. MonadThrow m => ParseSettings -> ConduitT ByteString o m Document
- toEvents :: Document -> [Event]
- elementToEvents :: Element -> [Event]
- fromEvents :: forall (m :: Type -> Type) o. MonadThrow m => ConduitT EventPos o m Document
- elementFromEvents :: forall (m :: Type -> Type) o. MonadThrow m => ConduitT EventPos o m (Maybe Element)
- renderBuilder :: forall (m :: Type -> Type) i. Monad m => RenderSettings -> Document -> ConduitT i Builder m ()
- renderBytes :: forall (m :: Type -> Type) i. PrimMonad m => RenderSettings -> Document -> ConduitT i ByteString m ()
- renderText :: forall (m :: Type -> Type) i. (MonadThrow m, PrimMonad m) => RenderSettings -> Document -> ConduitT i Text m ()
- data InvalidEventStream
  - = ContentAfterRoot EventPos
  - | MissingRootElement
  - | InvalidInlineDoctype EventPos
  - | MissingEndElement Name (Maybe EventPos)
  - | UnterminatedInlineDoctype
- def :: Default a => a
- data ParseSettings
- psDecodeEntities :: ParseSettings -> DecodeEntities
- psRetainNamespaces :: ParseSettings -> Bool
- data RenderSettings
- rsNamespaces :: RenderSettings -> [(Text, Text)]

# Non-streaming functions

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

readFile :: ParseSettings -> FilePath -> IO Document Source #

# Lazy bytestrings

renderLBS :: RenderSettings -> Document -> ByteString Source #

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

parseLBS_ :: ParseSettings -> ByteString -> Document Source #

# Text

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

parseText_ :: ParseSettings -> Text -> Document Source #

sinkTextDoc :: forall (m :: Type -> Type) o. MonadThrow m => ParseSettings -> ConduitT Text o m Document Source #

# Byte streams

sinkDoc :: forall (m :: Type -> Type) o. MonadThrow m => ParseSettings -> ConduitT ByteString o m Document Source #

# Streaming functions

toEvents :: Document -> [Event] Source #

Render a document into events.

elementToEvents :: Element -> [Event] Source #

Render a document element into events.

Since: 1.3.5

fromEvents :: forall (m :: Type -> Type) o. MonadThrow m => ConduitT EventPos o m Document Source #

Parse a document from a stream of events.

elementFromEvents :: forall (m :: Type -> Type) o. MonadThrow m => ConduitT EventPos o m (Maybe Element) Source #

Try to parse a document element (as defined in XML) from a stream of events.

Since: 1.3.5

renderBuilder :: forall (m :: Type -> Type) i. Monad m => RenderSettings -> Document -> ConduitT i Builder m () Source #

renderBytes :: forall (m :: Type -> Type) i. PrimMonad m => RenderSettings -> Document -> ConduitT i ByteString m () Source #

renderText :: forall (m :: Type -> Type) i. (MonadThrow m, PrimMonad m) => RenderSettings -> Document -> ConduitT i Text m () Source #

# Exceptions

data InvalidEventStream Source #

Constructors

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

#### Instances

Instances details

Exception InvalidEventStream Source # |
Instance details Defined in Text.XML.Unresolved Methods toException :: InvalidEventStream -> SomeException Source # fromException :: SomeException -> Maybe InvalidEventStream Source # displayException :: InvalidEventStream -> String Source # backtraceDesired :: InvalidEventStream -> Bool Source #
Show InvalidEventStream Source # |
Instance details Defined in Text.XML.Unresolved Methods showsPrec :: Int -> InvalidEventStream -> ShowS Source # show :: InvalidEventStream -> String Source # showList :: [InvalidEventStream] -> ShowS Source #

# Settings

def :: Default a => a Source #

The default value for this type.

## Parse

data ParseSettings Source #

#### Instances

Instances details

Default ParseSettings Source # |
Instance details Defined in Text.XML.Stream.Parse Methods def :: ParseSettings Source #

psDecodeEntities :: ParseSettings -> DecodeEntities Source #

psRetainNamespaces :: ParseSettings -> Bool Source #

Whether the original xmlns attributes should be retained in the parsed values. For more information on motivation, see:

https://github.com/snoyberg/xml/issues/38

Default: False

Since 1.2.1

## Render

data RenderSettings Source #

#### Instances

Instances details

Default RenderSettings Source # |
Instance details Defined in Text.XML.Stream.Render.Internal Methods def :: RenderSettings Source #

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

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.