Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is wrong with this xml format ?

Status
Not open for further replies.

SerbanC

Programmer
Oct 7, 2019
1
0
0
RO
I have a python script that loads a pdf converts it to base 64 and puts it into an xml and makes a POST Request to a link.

With my XML formatting I get 400 code Bad Request.

This is my XML, is it something wrong ? Am I missing something ?

xml = """<header xmlns=\"mfp:anaf:dgti:spv:reqUploadFisier:v1\"
xmlns:xsi=\"<upload fisier=\"" +"""+b64+"""+ "\"/></header>"""

The three quotes mean multi line in Python

Thanks in advance
 
Hi

That does not really look like syntactically valid XML. Better double check those triple quotes :
Code:
b64 [teal]=[/teal] [i][green]'U2VyYmFuQw=='[/green][/i]

xml [teal]=[/teal][i][green] """<header xmlns=\"mfp:anaf:dgti:spv:reqUploadFisier:v1\"[/green][/i]
[i][green]xmlns:xsi=\"[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance\">[/URL][/green][/i]
[i][green]<upload fisier=\"" +"""[/green][/i][teal]+[/teal]b64[teal]+[/teal][i][green]"""+ "\"/>\[/green][/i]
[i][green]</header>"""[/green][/i]

[b]print[/b] xml
Code:
[blue]bash-5.0$[/blue] python SerbanC.py
<header xmlns="mfp:anaf:dgti:spv:reqUploadFisier:v1"
xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance">[/URL]
<upload fisier="[COLOR=red yellow]" +[/color]U2VyYmFuQw==[COLOR=red yellow]+ "[/color]"/></header>
So far this looks more like a question for forum278.


Feherke.
feherke.github.io
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top