Python2 extracting tags from xml



I have xml document that I need to parse, but I am stuck, I may say at the very beggining. Here is part of xml file.



<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://ift.tt/IH78KX"
xsi:schemaLocation="http://ift.tt/IH78KX http://ift.tt/HBk9RF"
xmlns:xsi="http://ift.tt/ra1lAU">


I want to print out element tags only. I do it with this piece of code form python docs. I issue these commands at python interpreter.



tree = ET.parse('pom.xml')
root = tree.getroot()
root = ET.fromstring(data)
root.tag


root.tag returns this



{http://ift.tt/1ttli92


Is expected result just



project


?


No comments:

Post a Comment