Read IDML file format specification (pdf).
IDML is an XML representation of an InDesign document or components. This document describes the structure of IDML files, the XML schema for IDML validation, and provides examples of IDML file content. This document has been updated for IDML version 7.0, which corresponds to InDesign CS5. Sections that are new in this version are indicated by the notation “(IDML 7.0).”
You can also use some SDK from Adobe