Saxy v1.3.0 Saxy.Partial View Source
Supports parsing an XML document partially. This module is useful when
the XML document cannot be turned into a Stream
e.g over sockets.
Example
iex> {:ok, partial} = Saxy.Partial.new(StackHandler, [])
iex> {:cont, partial} = Saxy.Partial.parse(partial, "<foo>")
iex> {:cont, partial} = Saxy.Partial.parse(partial, "</foo>")
iex> Saxy.Partial.terminate(partial)
{:ok,
[
end_document: {},
end_element: "foo",
start_element: {"foo", []},
start_document: []
]}
Link to this section Summary
Functions
Builds up a Saxy.Partial
, which can be used for later parsing
Continue parsing next chunk of the document with a partial
Terminates the XML document parsing
Link to this section Types
Link to this section Functions
Link to this function
new(handler, initial_state, options \\ [])
View Source
new(handler :: module(), initial_state :: term(), options :: Keyword.t()) :: {:ok, partial :: t()} | {:error, exception :: Saxy.ParseError.t()}
Builds up a Saxy.Partial
, which can be used for later parsing.
Continue parsing next chunk of the document with a partial.
This function can return in 3 ways:
{:cont, partial}
- The parsing process has not been terminated.{:halt, user_state}
- The parsing process has been terminated, usually because of parser stopping.{:halt, user_state, rest}
- The parsing process has been terminated, usually because of parser halting.{:error, exception}
- The parsing process has erred.
Link to this function
terminate(partial)
View Source
terminate(partial :: t()) :: {:ok, state :: term()} | {:error, exception :: Saxy.ParseError.t()}
Terminates the XML document parsing.