XML - Stream of event Programming Model

> Markup Language (ML) > Extensible Markup Language (XML)

1 - About

Streaming refers to a programming model in which XML infosets

  • are transmitted and parsed serially:
    • at application runtime,
    • often in real time,
    • and often from dynamic sources
  • whose contents are not precisely known beforehand.

Streaming provides high performance (smaller memory footprint, reduced processor requirements).

As you can only see the XML infosets state at one location at a time in the document, you need to know what processing you want to do before reading the XML document.

Streaming models are particularly useful when your application:

  • has strict memory limitations (cellphone, …)
  • needs to process several requests simultaneously (application server)

3 - Mode

3.1 - Pull

the client only gets (pulls) XML data when it explicitly asks for it.

3.2 - Push

the parser sends the data whether or not the client is ready to use it at that time.