■ parse 함수를 사용해 XML 파일을 로드하는 방법을 보여준다.
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import xml.dom.minidom document = xml.dom.minidom.parse("book.xml") print(document.toxml()) """ <?xml version="1.0" ?><booklist cnt="3"> <book ISBN="0399250395"> <title>The Very Hungry Caterpillar Pop-Up Book</title> <author name="Eric Carle"/> <author name="Keith Finch"/> <publisher> Philomel Books</publisher> <description> Celebrating the 40th anniverary of one of the most popular children's books ever created</description> </book> <book ISBN="0964729237"> <title lang="english">The Shack</title> </book> <book ISBN="0553281097"> <title>You Can Negotiate Anything</title> <author name="Herb Cohen"/> <category cid="12">Negotiate and narrative skill</category> </book> </booklist> """ |