Python Forum
[SOLVED] Using Python to connect to an XML ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Using Python to connect to an XML ?
#21
Thanks @snippsat

Initially I was using a different XML file for testing, and got a warning ..

Quote:read_xml_10.py:8: XMLParsedAsHTMLWarning: It looks like you're parsing an XML document using an HTML parser. If this really is an HTML document (maybe it's XHTML?), you can ignore or filter this warning. If it's XML, you should know that using an XML parser will be more reliable. To parse this document as XML, make sure you have the lxml package installed, and pass the keyword argument features="xml" into the BeautifulSoup constructor.
soup = BeautifulSoup(file, 'lxml')

No doubt because it was the full (large) file. I notice though, there are 3 sets of totals though, not 2, as there are two account numbers. That will be because "append" is used.
Reply
#22
(Dec-01-2024, 11:58 PM)jehoshua Wrote: Initially I was using a different XML file for testing, and got a warning ..
That's just a warning,just ignore it it make no difference in output,sometime html parser works better for xml.
Can just do this.
import warnings
from bs4 import UserWarning
warnings.filterwarnings("ignore", category=UserWarning, module='bs4')
jehoshua likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  connect sql by python using txt. file dawid294 2 2,063 Jan-12-2024, 08:54 PM
Last Post: deanhystad
  How to Connect to PostgreSQL Through Jump Server and SSH Tunnel using Python? nishans 1 3,843 Jan-02-2024, 10:37 AM
Last Post: khanzain
  python connect to mssql wailoonho 7 5,494 Dec-07-2023, 02:06 AM
Last Post: wailoonho
  Trying to make a bot to connect on discord with Selenium Python johnsmith43 2 73,077 Mar-21-2022, 02:56 PM
Last Post: Cloudytechnical
  How to connect Mysql databse with python and VSCode IDE madhusoodhananER 1 9,730 Oct-31-2019, 10:15 AM
Last Post: Larz60+
  Connect a Teradata DB to Python OscarBoots 10 11,308 Jan-31-2019, 10:23 PM
Last Post: OscarBoots
  Python connect to Sybase IQ FORTITUDE 1 5,711 Jan-24-2019, 02:14 AM
Last Post: micseydel
  How to connect Atom and Python? Jack_Sparrow 1 4,413 May-01-2018, 10:53 AM
Last Post: Larz60+
  connect to remote database via python script sunstar20 5 6,518 Apr-23-2018, 11:05 AM
Last Post: Gribouillis
  Can anyone Please help on fixing this python code to connect and save things on sqlit Roscoes 2 3,594 Mar-06-2018, 04:48 AM
Last Post: Roscoes

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020