Answer the question
In order to leave comments, you need to log in
How to remove xml declaration for parsing with lxml objectify?
There is an xml response from the view server:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<A>
<url replyId="fb71e2db-2912-44c3-aab6-e92ced783e11">http://localhost:8080/opt/out/Ticket/3</url>
<url replyId="4ca8fbae-b05f-42bf-bf22-16fa7d2a2b0b">http://localhost:8080/opt/out/Ticket/5</url>
<url replyId="e3cdc104-98a9-4b45-941a-559649c6969a">http://localhost:8080/opt/out/Ticket/6</url>
<ver>1</ver>
</A>
ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
import requests
from lxml import objectify as ob
r = requests.get('http://localhost:8080/opt/out')
obj = ob.fromstring(r.text)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question