昨日のエントリーでgoogle app engineでlxmlを使ってxmlをパースする方法を書いたので、名前空間を取得する方法について書く。
import urllib
from urlparse import urlparse
from google.appengine.api import urlfetch
from lxml import etree
url = ""
result = urlfetch.fetch(url)
root = etree.fromstring(result.content)
ns = root.xpath("namespace-uri(.)")
namespace = {"ns":ns}
0 コメント:
コメントを投稿