← 返回首页
Refactor parse_xml function to handle external target references (Issue #1349) by al-rahul · Pull Request #1350 · python-openxml/python-docx · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Refactor parse_xml function to handle external target references (Issue #1349)#1350

Open
al-rahul wants to merge 1 commit into
python-openxml:masterfrom
al-rahul:master
Open

Refactor parse_xml function to handle external target references (Issue #1349)#1350
al-rahul wants to merge 1 commit into
python-openxml:masterfrom
al-rahul:master

Conversation

Copy link
Copy Markdown

The added code checks if self.target_ref exists and if it starts with a "#", which is a common way to denote external references. If both conditions are met, the method returns RTM.EXTERNAL, indicating that the target reference is external.

This change improves the robustness of our code by correctly handling and classifying external references. This will prevent potential errors or unexpected behavior when encountering such references.

Copy link
Copy Markdown

SebG-js commented Mar 17, 2025
edited
Loading

Hello
I met this issue.
It could be interesting to get this fix in the main branch.

def getinfo(self, name): """Return the instance of ZipInfo given 'name'.""" info = self.NameToInfo.get(name) if info is None: > raise KeyError( 'There is no item named %r in the archive' % name) E KeyError: "There is no item named 'word/#schémaglobal' in the archive"

Copy link
Copy Markdown

Hello
I met this issue.
Would be great to apply the known fix :)

Copy link
Copy Markdown

SebG-js commented May 28, 2025

Hello @al-rahul
Thank you for the fix.
Could you resolve the conflicts ?
I am interested by the fix in the master branch.

Copy link
Copy Markdown
Author

Hello @al-rahul Thank you for the fix. Could you resolve the conflicts ? I am interested by the fix in the master branch.

I've made a pull request already, but the repo owner seems to be inactive and hasn't touched it in more than a year.

Copy link
Copy Markdown

SebG-js commented May 28, 2025

Hello @scanny
@al-rahul proposed an interesting fix.
Are you an active contributor of this project ?
Could you help us ?

Maybe the repo owner can add new active contributors ?

Copy link
Copy Markdown

+1 I also faced a similar issue and I tried the change of this PR and it works. Please, it would be very useful if the proposed PR could get merged.

Copy link
Copy Markdown

@scanny you appear to be the #1 contributor in this repository, can you please have a look to this PR and let us know if this can get merged?

Copy link
Copy Markdown

@ondrej-111 if @scanny can't, can you maybe help with this?

Copy link
Copy Markdown

Possible temporary fixes, in your requirements.txt instead of python-docx==1.1.2 or similar, use instead:

OPTION A:
python-docx @ git+https://github.com/al-rahul/python-docx.git@4ebb3ac
Thank you @al-rahul

OPTION B:
python-docx @ git+https://github.com/TommasoPetrolito/python-docx.git@66fa597
This last one is a merge into the current master branch as per the latest version available (including solved conflicts)

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Footer

© 2026 GitHub, Inc.