A method and computer-readable medium are provided for selectively
importing and exporting data in an electronic document. An import
application program interface (API) may be implemented to import content
from a hierarchically structured document, such an XML file. The import
API works in conjunction with a parser to scan the document and extract
content from selected elements, nodes, attributes, and text. The import
API also utilizes a callback component for processing the extracted
content. An export API may also be implemented to export data to create a
hierarchically structured document, such as an XML file. The export API
works in conjunction with a writer to receive data and export the data as
elements, nodes, attributes, and text in the hierarchically structured
document.