Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XMLDiff doesnt return the entire xml path in the difference result #52

Closed
jbhatt091 opened this issue Sep 4, 2019 · 4 comments
Closed
Labels
bug Something isn't working upstream This should be fixed upstream (lxml, Python, ...)

Comments

@jbhatt091
Copy link

I am trying to list difference with edit script but it doesn't return the entire path in "node". I am getting below result:

UpdateAttrib(node='//[7]', name='root', value='2.16.840.1.113883.4.391.109.1001.310651.18565.20190829143007')
RenameNode(node='//[10]', tag='{urn:hl7-org:v3}effectiveTime')

Below is my code:

from xmldiff import main
result = main.diff_files(File1, File2)

Instead, I am looking for result like below (full path):

UpdateAttrib(node='/ClinicalDocument/id[1]', name='root', value='2.16.840.1.113883.4.391.109.1001.310651.18565.20190829143007')

How do I achieve this?

@regebro
Copy link
Contributor

regebro commented Sep 15, 2019

Can you give me the example XML's? Ultimately it's the lxml library that tells us the xpath to an element, but it's usually not that bad...

@jbhatt091
Copy link
Author

Sample_File_with_Diff_result_CSV.zip

Please see attached sample XML file. Basically, I am using xml diff to compare two files and for each file CSV will be generated with the diff result. I have added sample result CSV as well in the same zip folder.

@regebro
Copy link
Contributor

regebro commented Sep 15, 2019

Aha, I see, it's the default namespace that messes it up. There might be workarounds for that, but there might also be a reason that lxml uses paths like /*/*[2] when you have a default namespace. That would need investigation.

@regebro regebro added bug Something isn't working upstream This should be fixed upstream (lxml, Python, ...) and removed waiting for feedback labels Sep 15, 2019
@jbhatt091
Copy link
Author

Got it; I added code to clean up namespace and it resolved the issue. Appreciate your help; Thank you so much.

@regebro regebro closed this as completed Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream This should be fixed upstream (lxml, Python, ...)
Projects
None yet
Development

No branches or pull requests

2 participants