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

Written XML is not valid #25

Closed
iannesbitt opened this issue Jun 1, 2023 · 2 comments
Closed

Written XML is not valid #25

iannesbitt opened this issue Jun 1, 2023 · 2 comments
Assignees
Labels
bug Something isn't working v0.1.1 Version 0.1.1 item
Milestone

Comments

@iannesbitt
Copy link
Contributor

Written XML string must be changed according the following:

-<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ns2:person xmlns:ns2=\"http://ns.dataone.org/service/types/v1\"><subject>http://orcid.org/0000-0001-5828-6070</subject><givenName>Ian</givenName><familyName>Nesbitt</familyName><verified>false</verified></ns2:person>
+<?xml version="1.0" encoding="utf-8"?><ns2:person xmlns:ns2="http://ns.dataone.org/service/types/v1"><subject>http://orcid.org/0000-0001-5828-6070</subject><givenName>Ian</givenName><familyName>Nesbitt</familyName><verified>false</verified></ns2:person>
  • Remove \ before quotes
  • Remove \n
@iannesbitt iannesbitt self-assigned this Jun 1, 2023
@iannesbitt iannesbitt added the bug Something isn't working label Jun 1, 2023
iannesbitt added a commit that referenced this issue Jun 1, 2023
iannesbitt added a commit that referenced this issue Jun 1, 2023
@mbjones
Copy link
Member

mbjones commented Jun 1, 2023

@iannesbitt that escaping was probably because the XML was being sent via a shell script and curl. As you move the work over to Python, building the XML object from a string is not a very robust way of handling it. I think it would be better to use the core pyxb types that we have in our core d1_python library, such as the Subject class, which knows how to serialize and deserialize instances with proper escaping into XML. This will prevent problems down the line if the data you are putting in the subject fields contains characters that need to be escaped in the XML serialization.

iannesbitt added a commit that referenced this issue Jun 5, 2023
iannesbitt added a commit that referenced this issue Jun 5, 2023
@iannesbitt
Copy link
Contributor Author

Changes have been made but will soon be obsoleted by #26

@iannesbitt iannesbitt added this to the 0.1.1 milestone Oct 4, 2023
@iannesbitt iannesbitt added the v0.1.1 Version 0.1.1 item label Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v0.1.1 Version 0.1.1 item
Projects
None yet
Development

No branches or pull requests

2 participants