Skip to content

Instantly share code, notes, and snippets.

@netdesign
Created September 24, 2011 18:18
Show Gist options
  • Select an option

  • Save netdesign/1239661 to your computer and use it in GitHub Desktop.

Select an option

Save netdesign/1239661 to your computer and use it in GitHub Desktop.
XML extract
<ExternalPage about="http://www.ghostcircles.com/">
<d:Title>Diana X. Sprinkle's Art</d:Title>
<d:Description>Anime, furry, comic, and weird art. Covering over seven years of work.</d:Description>
<topic>Top/Arts/Animation/Anime/Fandom/Fan_Works/Fan_Art/D</topic>
</ExternalPage>
<?xml version="1.0" encoding="UTF-8"?>
<RDF xmlns:r="http://www.w3.org/TR/RDF/" xmlns:d="http://purl.org/dc/elements/1.0/" xmlns="http://dmoz.org/rdf/">
<!-- Generated at 2011-09-18 00:02:20 EST from DMOZ 2.0 -->
<Topic r:id="">
<catid>1</catid>
</Topic>
<Topic r:id="Top/Arts">
<catid>381773</catid>
</Topic>
<Topic r:id="Top/Arts/Animation">
<catid>423945</catid>
<link1 r:resource="http://www.awn.com/"></link1>
<link r:resource="http://animation.about.com/"></link>
<link r:resource="http://www.toonhound.com/"></link>
<link r:resource="http://enculturation.gmu.edu/2_1/pisters.html"></link>
<link r:resource="http://www.digitalmediafx.com/Features/animationhistory.html"></link>
<link r:resource="http://www-viz.tamu.edu/courses/viza615/97spring/pjames/history/main.html"></link>
<link r:resource="http://www.spark-online.com/august00/media/romano.html"></link>
<link r:resource="http://www.animated-divots.net/"></link>
</Topic>
<ExternalPage about="http://www.awn.com/">
<d:Title>Animation World Network</d:Title>
<d:Description>Provides information resources to the international animation community. Features include searchable database archives, monthly magazine, web animation guide, the Animation Village, discussion forums and other useful resources.</d:Description>
<priority>1</priority>
<topic>Top/Arts/Animation</topic>
</ExternalPage>
<ExternalPage about="http://animation.about.com/">
<d:Title>About.com: Animation Guide</d:Title>
<d:Description>Keep up with developments in online animation for all skill levels. Download tools, and seek inspiration from online work.</d:Description>
from xml.dom.pulldom import START_ELEMENT, parse
from lxml import etree
src = 'content.rdf.u8'
doc = parse(src)
for event, node in doc:
if event == START_ELEMENT and node.localName == "ExternalPage":
doc.expandNode(node)
parser = etree.XMLParser(dtd_validation=False,recover=True,no_network=True)
tree = etree.parse(node.toxml(), parser)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment