blob: 25d4ba191fe950e8a76ac71d1e2ba7fffad9f21d (
plain)
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
|
# atomgen.py
import os.path
from lxml import etree
from lxml.builder import ElementMaker
ATOM_NAMESPACE = "http://www.w3.org/2005/Atom"
A = ElementMaker(namespace=ATOM_NAMESPACE,
nsmap={None : ATOM_NAMESPACE})
feed = A.feed
entry = A.entry
title = A.title
author = A.author
name = A.name
link = A.link
summary = A.summary
id = A.id
updated = A.updated
# ... and so on and so forth ...
# plus a little validation function: isvalid()
isvalid = etree.RelaxNG(
file=os.path.join(os.path.abspath(os.path.dirname(__file__)), "atom.rng"))
|