Created
December 21, 2022 12:13
-
-
Save FernandoCelmer/9f7806ab28ccea15fc371c0841d05f49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
beautifulsoup4==4.11.1 | |
lxml==4.9.2 | |
""" | |
_file = """<?xml version="1.0"?> | |
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> | |
<soap:Header> | |
</soap:Header> | |
<soap:Body> | |
<m:GetUser> | |
<m:UserId>User-01</m:UserId> | |
<m:UserId>User-02</m:UserId> | |
<m:UserId>User-03</m:UserId> | |
</m:GetUser> | |
</soap:Body> | |
</soap:Envelope>""" | |
from bs4 import BeautifulSoup | |
content = [] | |
# with open("file.xml", "r") as file: | |
# content = file.readlines() | |
# content = "".join(content) | |
# bs_content = BeautifulSoup(content, "xml") | |
bs_content = BeautifulSoup(_file, "xml") | |
users = bs_content.find_all("GetUser") | |
for user in users: | |
print(user.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment