docx_parser_converter.docx_parsers.helpers.docx_xml_list module

docx_parser_converter.docx_parsers.helpers.docx_xml_list.extract_docx_xml(docx_path: str)[source]

Extracts and pretty prints XML files from a DOCX file.

This function extracts all XML files from a DOCX file, pretty prints the XML content, and saves each XML file’s content to a .txt file in a directory named after the DOCX file.

Parameters:

docx_path (str) – The file path to the DOCX file.

Raises:

ValueError – If the provided file is not a .docx file.

Example

The following is an example of how to use this function:

extract_docx_xml("path/to/your/document.docx")

The function will create a directory named after the DOCX file and save the extracted and pretty printed XML files as .txt files in that directory.