Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Text Editing&Processing > Markup

    XPathRecord 0.3

    Download button

    No screenshots available
    Downloads: 296  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Corey Porter | More programs
    Creative Commons Att... / FREE
    August 6th, 2009, 19:58 GMT
    ROOT / Text Editing&Processing / Markup

     Read user reviews (0)  Refer to a friend  Subscribe

    XPathRecord description

    An XML to read-only Python objects library

    XPathRecord is a software that seeks to take some of the grunt work out of transforming XML in to objects. Follows is a very brief example of an RSS parser.

    import xpathrecord

    class RSSPost(xpathrecord.XPathRecord):
    title = xpathrecord.TextField('title/text()')
    link = xpathrecord.TextField('link/text()')
    pubdate = xpathrecord.DatetimeField('pubDate/text()',
    '%a, %d %b %Y %H:%M:%S +0000')

    def main():
    import libxml2, urllib2, sys
    for feed_url in sys.argv[1:]:
    doc = urllib2.urlopen(feed_url).read()
    dom = libxml2.parseMemory(doc, len(doc))
    for post in RSSPost.records(dom, '//item'):
    print 'Post:'
    print ' title: %s' % post.title()
    print ' link: %s' % post.link()
    print ' date: %s' % post.pubdate()

    if '__main__' == __name__:
    main()



    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    XML markup | Python objects library | XML to objects | XML | objects | library

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM