Join Joe Marini for an in-depth discussion in this video Manipulating XML, part of Learning Python.
Sometimes when you're processing markup like XML or HTML, you don't want to build…a parser that just runs through the document one line at a time.…What you'll need to do is have the entire document in memory.…In other words you'll need to operate on the document's dom.…And in this example, we'll see how the use the XML minidom class that Python provides…to load an XML file and then operate on the document while it's in memory.…So let's open up the xmlparsing_start.py file and over here in the snippets, let's…copy this line right here 523 and paste it in.…
So now I'm importing the xml.dom.minidom module and I'm going to use the minidom…class to parse an XML file. And the XML file I'm going to be parsing…is this one right here, samplexml.xml. So let's open it up and take a look at it,…and you can see that it's a pretty standard XML file.…It's just got some basic information about a person in it.…So you can see there's my name, where I live, various skills that I have, that…kind of stuff. Again just a sample XML file for parsing.…
- Installing Python
- Choosing an editor/IDE
- Working with variables and expressions
- Writing loops
- Using the date, time, and datetime classes
- Reading and writing files
- Fetching Internet data
- Parsing and processing HTML
Skill Level Beginner
1. Preparing the Development Environment
2. Python Basics
3. Working with Dates and Times
4. Working with Files
5. Working with Web Data
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.