May-13-2021, 03:27 PM
(May-13-2021, 01:44 AM)MDRI Wrote: We know Python is interpreter language.Performance is no problem as eg lxml has C speed.
Is Pyhton the right one to do the above for performance?
What are the option we have ?
lxml Wrote:The lxml XML toolkit is a Pythonic binding for theC libraries
libxml2 and libxslt.
It is unique in that it combines the speed and XML feature completeness of these libraries with the simplicity of a native Python API
(May-13-2021, 01:44 AM)MDRI Wrote: The above input XML messages need to be validated against XML Schema (xsd) for schema comliantValidation with lxml
Quote:The validated XML messages to be parses and extract the data .I like to use BS for parsing,still same speed as here use lxml as parser.
import requests from bs4 import BeautifulSoup url = 'http://httpbin.org/xml' response = requests.get(url) soup = BeautifulSoup(response.content, 'lxml') title = soup.select_one('title') print(title) print(title.text)
Output:<title>Wake up to WonderWidgets!</title>
Wake up to WonderWidgets!