In our InDesign document all content needs to be attached to an appropriate style element.
We can use:
We then need tags that will be mapped to those elements. They can (optionally) be the same names as our InDesign styles. They may also come from a DTD uploaded to our InDesign file in the structure pane.
With a Shakespeare play in mind we have a DTD that we can import into InDesign. This provides us with the TAGS. If we name our styles with those same tags, we can 'map the syles to the tags' very easlily.
Unfortunately, InDesign does not provide us with the automation to map object styles, so we need to add those in to the structure.
Please NOTE: I no longer recommend the use of PDFXML Inspector from Adobe and this presentation covers the use of InDesign version CS5 not CS5.5 which has significant improvements in regard to ePUB export..
You may also want to watch the instructional screencast on the same subject.
I have done something similar before but here is a fresh look at building a simple InDesign document, adding some paragraph and character styles and tags - and then building a relationship between them.
If we source a public domain text on the web, such as those from the Gutenberg project, we may well find that each line of thext has a fixed length. This is because the text was probably scanned in and then converted to real text through OCR software. The text is laid out exactly as it was in the original source. This facsimile is not appropriate for our needs.