GoogleIt Mail IT Print IT PermaLinkLotusScript Utility Routines For XML DOM Processing
11:44:30 AM
Written By : Richard SchwartzCategory : IBM Lotus Notes And Domino
Location : Nashua, NH

A few weeks ago, I posted JavaScript ports of a few LotusScript routines that I initially wrote for my bloggregator and have found to be generally useful as a higher-level shell around processing XML using the standard DOM parsing routines. Since those JavaScript versions haven't been ripped apart by critics, I figure I can get away with posting the original LotusScript versions of those routines, and more. I had hoped the "and more" might include some brand new routines that I thought I could come up with to deal with some problems that Rocky mentioned, but alas my efforts to create some shell routines to encapsulate logic for updating the DOM tree ran into a bunch of brick walls. Still, there is more here than what I had ported to JavaScript. Quite a lot more. To accomodate limits within the Blogsphere template, I've had to separate the code for these functions into four separate pages.


The first page has the code for my routines for finding the first or Nth element with a given name starting at a point in an XML stream, and for processing XML text elements. These are the routines that formed the basis of the JavaScript routines posted earlier. The routines setTextItemFromElement() and setRichTextItemFromElement() are particularly useful, doing pretty much what their name implies: transferring text data out of an XML DOM element (i.e., the text found between an opening <tag> and it's closing </tag>) into a back-end text or rich text item. Both use the getElementText() function to actually take care of the dirty work of navigating down through the DOM tree and to deal with various error case as well as the possibility that text is enclosed within a CDATA section.


The second page has routines you can use to deal with text stored as an attribute of a tag (i.e., <tag value='this is the text we want'> rather than being enclosed between the <tag> and </tag>). The routines are called getElementAttributeText() setTextItemFromElementAttribute() and setRichTextItemFromElementAttribute(). There isn't as much under the covers here, but these routines do at least relieve you of having to remember to handle gracefully cases with nodes that don't actually have the attribute you are looking at.


The third and fourth pages both deal with processing dates. These were without question the most troublesome pieces of code in all of the RSS processing work that I have done. (For some good info on date formats in RSS feeds, see here.) I can't claim that they'll deal with every possible variation of date formatting that you might run into in an RSS, Atom or other XML stream, but the routines have been very stable for a long time, by which I mean that they haven't thrown errors or grossly misinterpreted a lot of dates that otherwise should have been processed, so I think you may find them useful. For processing what I refer to in the code as "natural language dates", they are set up for English only, but the initMonths() function (which you have to call before trying to process a date with these routines) is easy enough to modify for other languages. The setDateItemFromElement does what it's name implies: it extracts a date value from an XML element (i.e., the string between an opening and closing tag), and stores it in a back-end text item in a NotesDocument. This routine uses the LotusScript 'Like' statement to do pattern matching. It distinguishes between the following formats: ISO-8061 ("2005-06-02" and "2005-06-02T12:47:32-0500"), RFC-822 dates ("Thursday, 02 June 2005 01:23:45 EST" and "02 June 2005 01:23:45 EST"), and even plain old "06/02/2005 12:47" (but note that I don't even try to distinguish between mm/dd/yyyy and dd/mm/yyyy in this format, because I figure that anyone who is serious about getting dates right in XML really ought to be using the ISO or RFC compliant formats). If you want to use the routines at a lower level than setDateItemFromElement, you're welcome to, of course. They all return NotesDateTime, and they are convertISO8061Date(), convertISO8061DateTime(), and for the RFC-822 dates they are convertNaturalLangDate1() and convertNaturalLangDate2(). Sorry about the not so descriptive names of the latter functions, but I'm sometimes a bit superstitious about things. There was one routine convertNaturalLangDate(), which got too messy so I split it into two routines and when I was satisfied they were working I just left the names alone rather than risk annoying the coding demons.

This page has been accessed 2102 times. .
Comments :v

1. Bruce Elgort06/03/2005 08:12:14 PM
Homepage: http://www.bruceelgort.com


Rich,

These routines are great! I have used them in my OS X Tiger Dahsboard Widgets.

Thanks for sharing this code with us.

Bruce




2. tom06/21/2007 03:51:38 PM
Homepage: http://theoneils.net


thanks




3. vesoftware11/05/2013 10:24:32 PM
Homepage: http://vesoftware.blogspot.com/2013/10/itupokercom-agen-poker-online-indonesia.html


Agen Bola Promo 100% SBOBET IBCBET Casino Poker Tangkas Online
http://vesoftware.blogspot.com/2013/10/agen-bola-promo-100-sbobet-ibcbet.html
ITUPOKER.COM AGEN POKER ONLINE INDONESIA TERPERCAYA
http://vesoftware.blogspot.com/2013/10/itupokercom-agen-poker-online-indonesia.html
alfaonline.com : Toko belanja online murah, Promo heboh jual barang hanya Rp 1,-
http://vesoftware.blogspot.com/2013/10/alfaonlinecom-toko-belanja-online-murah.html
BELAJAR SEO
http://balapseo.blogspot.com/




4. 51316914103/03/2016 08:57:22 PM
Homepage: http://www.michaelkorshandbags.in.net/


http://www.ferragamooutletstore.net/
http://www.coachoutletonline-stores.us.com/
http://www.mulberry-bags.co.uk/
http://www.tomsshoes.me.uk/
http://www.jeanstruereligion.in.net/
http://www.ferragamoshoes.com.co/
http://www.coach-onlineoutlet.us.com/
http://www.ralphlauren-uk.org.uk/
http://www.clearancefitflopssale.com/
http://www.lululemonoutlet.org.uk/
http://www.omegawatches.me.uk/
http://www.truereligionjeanssale.in.net/
http://www.rayban--sunglasses.me.uk/
http://www.polo-ralphlauren.com.co/
http://www.poloralph-lauren.org.uk/
http://www.outletmulberry.org.uk/
http://www.celine-outlet.us.com/
http://www.tiffanyand-co.in.net/
http://www.discount-raybansunglasses.us.com/
http://www.oakleysunglassescanada.ca/
http://www.louisvuitton-handbags.org.uk/
http://www.ferragamo-shoes.us.com/
http://www.toryburchoutlet-online.us.com/
http://www.replicawatches-forsale.us.com/
http://www.oakley-sunglasses.org.uk/
http://www.bottega-venetaoutlet.net/
http://www.handbagsdesigner.us.com/
http://www.truereligionjeansoutlet.co.uk/
http://www.ralphlauren-polo.in.net/
http://www.rolexwatchesoutlet.us.com/
http://www.coachoutletclearance.us.com/
http://www.oakleysunglassessdiscount.us.com/
http://www.truereligion.org.uk/
http://www.wholesaleoakleysunglassess.us.com/
http://www.katespade.org.uk/
http://www.oakleysunglasses-cheap.us.com/
http://www.coachoutletfactory-store.us.com/
http://www.rolexwatchesforsale.me.uk/
http://www.mulberry-handbags.co.uk/
http://www.ralphlauren-outletuk.co.uk/
http://www.toryburchhandbags.in.net/
http://www.rolexoutlet.us.com/
http://www.hollisterclothing.cn.com/
http://www.truereligion-sale.in.net/
http://www.truereligionjeans.org.uk/
http://www.babylissflatiron.us.com/
http://www.fitflopssaleclearance.in.net/
http://www.jewelrytiffany.in.net/
http://www.tiffanyandcos.in.net/
http://www.wholesale-nbajerseys.com/
http://www.oakley-sunglasses.me.uk/
http://www.fitflopssale.co.uk/
http://www.coachoutletonline-factory.us.com/
http://www.ferragamo.me.uk/
http://www.oakleysunglassess-outlet.us.com/
http://www.fitflopsshoes.in.net/
http://www.ralphlaurenoutlet.org.uk/
http://www.ferragamoshoes.org.uk/
http://www.louisvuitton-handbags.me.uk/
http://www.ralphlauren-polo.org.uk/
http://www.beatsbydre.me.uk/
http://www.salvatore-ferragamo.in.net/
http://www.ralphlaurenpolo.com.co/
http://www.mulberry-handbagsoutlet.org.uk/
http://www.replicahandbagsoutlet.us.com/
http://www.raybansunglasses-online.us.com/
http://www.ray-bansunglassessale.us.com/
http://www.cheapreplicawatches.net/
http://www.chanel-handbagsoutlet.us.com/
http://www.toryburchoutletstore.in.net/
http://www.tiffanyoutlet.in.net/
http://www.sunglassesrayban.org.uk/
http://www.handbagschanel.us.com/
http://www.swarovskicrystals.com.co/
http://www.outletlongchamp.in.net/
http://www.outletchanel.us.com/
http://www.poloralph-lauren.in.net/
http://www.ralphlaurenpolo.us.com/
http://www.rolexwatchesforsale.in.net/
http://www.fitflopsoutletsale.com/
http://www.coachoutletstoreclearance.us.com/
http://www.michael-korsoutlet.me.uk/
http://www.katespadeuk.org.uk/
http://www.mulberrysale.co.uk/
http://www.swarovskicrystal.in.net/
http://www.burberryoutletstores.in.net/
http://www.oakley-sunglasseswholesale.us.com/
http://www.truereligionoutlet.org.uk/
http://www.outletraybansunglasses.us.com/
http://www.canadaoakleysunglasses.com/
http://www.burberryoutlet-sale.us.com/
http://www.storecoachoutlet.us.com/
http://www.wholesale-oakleysunglasses.us.com/
http://www.ghdhairstraighteners.org.uk/
http://www.fitflopssale.in.net/
http://www.cheapoakleysunglassesss.us.com/
http://www.montblancpenss.us.com/
http://www.toryburchshoes.in.net/
http://www.coach-factoryoutlets.us.com/
http://www.mulberryhandbagssale.co.uk/
http://www.cheapiphonecases.in.net/
http://www.tiffanyjewellery.org.uk/
http://www.michaelkors-outlet.me.uk/
http://www.tiffanyandco.me.uk/
http://www.katespadehandbags.co.uk/
http://www.outlettruereligion.in.net/
http://www.beats-bydre.org.uk/
http://www.longchamp-handbags.com.co/
http://www.hollisterclothingstore.in.net/
http://www.outletlululemon.in.net/
http://www.poloralph-lauren.us.com/
http://www.burberryoutlet-store.in.net/
http://www.tiffany-jewelry.com.co/
http://www.cheapoakley-sunglasses.us.com/
http://www.michael-korshandbags.co.uk/
http://www.michael-korsoutlet.org.uk/
http://www.ralphlaurenpoloshirts.org.uk/
http://www.handbagslongchamp.us.com/
http://www.outlettoryburch.in.net/
http://www.ralph-laurenoutlet.in.net/
http://www.michael-korsfactoryoutlet.us.com/
http://www.fitflopsshoes.org.uk/
http://www.hollisteruk.org.uk/
http://www.coachhandbagsclearance.us.com/
http://www.oakleysunglassesswholesale.us.com/
http://www.hollistershirts.org.uk/
http://www.coachoutlethandbags.us.com/
http://www.lululemonoutletonline.us.com/
0304




5. chenyingying10/17/2016 12:15:17 AM


http://www.seattleseahawksjerseys.us.com
http://www.canadagooseoutlet.eu.com
http://www.louisvuittonoutletdeals.us.com
http://www.uggbootsuk.com.co
http://www.raybansunglasses.me.uk
http://www.cheap--nfljerseys.us.com
http://www.bostoncelticsjerseys.com
http://www.giuseppe-zanotti.us
http://www.louisvuittonoutlet.net.co
http://www.jordan4.net
http://www.coachfactoryoutletclearances.us.com
http://www.tomsshoesuk.org.uk
http://www.louisvuittonparis.fr
http://www.pradahandbags.net
http://www.ralphlaurenoutletuk.in.net
http://www.cartierwatches.in.net
http://www.nike-rosherun.in.net
http://www.raybanoutlet.net.co
http://www.cincinnatibengalsjerseys.us.com
http://www.michaelkorsoutlet-onlinestore.us.com
http://www.adidasshoes.net
http://www.outlet-celine.com
http://www.uggsoutlet.de.com
http://www.jordan13.org
http://www.adidasoutletshoes.com
http://www.uggsbootsstore.com
http://www.canadagoosejackets.com.co
http://www.miamiheatjerseys.us.com
http://www.michaelkors--outlet.us.org
http://www.coachfactoryoutletonline.com.co
http://www.coachfactory-outlet.in.net
http://www.cheapoakleysunglasses.net.co
http://www.montblanc-pens.name
http://www.uggsoutlet.gr.com
http://www.michael-kors-handbags.us.org
http://www.clevelandcavaliersjerseys.us.com
http://www.ralphlauren-outlet.net.co
http://www.uggbootssale.de.com
http://www.pradaoutlet.net.co
http://timberland.officialfree.net
http://www.airmaxssale.com
http://www.canada-gooseoutlet.name
http://www.uggssale.com.co
http://www.louisvuitton.nom.co
http://www.nfljerseyswholesales.us
http://www.toryburch-outlet.in.net
http://www.louboutinshoessale.com
http://www.ugg-store.co.uk
http://www.nikeoutletstore.us.com
http://www.coachoutletstoreonlineclearances.com.co
http://www.gucci-outlet.name
http://www.ralphlaurenclearance.in.net
http://www.monclerjackets.com.co
http://www.raybanssunglasses.com.co
http://www.louisvuitton-discount.com
http://www.oakleyvaultoutlet.in.net
http://www.aididasyeezy.org.uk
http://www.cheapburberryoutlet.name
http://www.hermesbagusa.com
http://www.nike-airmaxpascher.fr
http://www.oklahomacitythunderjerseys.us.com
http://www.katespade-handbags.eu.com
http://www.adidas-yeezy.us.com
http://www.get-louisvuittonoutlet.com
http://www.uggcanada.in.net
http://www.newenglandpatriotsjerseys.us.com
http://www.christianlouboutinoutlet.com.co
http://www.coachoutletstoreonlineclearances.us.org
http://www.louisvuittonoutlet.de.com
http://www.burberry-outlet.com.co
http://www.coachfactoryoutletonlinesale.us.com
http://www.supra-shoes.net
http://www.raybansunglassess.com.co
http://www.ralphlaurenoutletonline.com.co
http://www.louis-vuittonoutlet.com.co
http://www.niketrainers.uk
http://www.authenticlouisvuittonhandbags.us.com
http://www.rayban-sunglasses.com.co
http://www.louis-vuittonoutlet.us.com
http://www.abercrombiekidsoutlet.name
http://www.true-religionoutlet.net.co
http://www.cheaprolexforsale.com
http://www.ralphlaurenuk.com.co
http://www.michaelhandbagsoutlet.us.com
http://www.michael-korsoutlets.eu.com
http://www.louisvuitton.me
http://www.kevindurantshoes.name
http://www.abercrombieoutletonline.cc
http://www.michaelkorsoutletforsale.com
http://www.jordansforsale.in.net
http://www.sunglassesoakley.com.co
http://www.coachcanadaoutlet.com.co
http://www.oakley-sunglasses.net.co
http://www.pittsburghsteelersjerseys.us.com
http://www.christianlouboutinsale.me.uk
http://www.adidassuperstar.name
http://ugg.uggsstore.eu
http://www.ralph-lauren.me.uk
http://www.lebronjames-shoes.net
http://www.canadagoose.de.com
chenyingying20161017




6. dongdong806/28/2017 11:38:03 PM


http://www.kobe12shoes.us.com
http://www.coachoutletsclearance.us.com
http://www.raybansunglassesoutlet.net.co
http://www.michaelkors--outlet.us.org
http://www.jpgconseil.fr
http://www.adidas-nmdxr1.us.com
http://www.lecoqsportifchaussures.fr
http://cheapoakley.sunglassesonline.us.com
http://www.adidasfootballboots.me.uk
http://www.oakleystore.com.co
http://www.nikeairmax2016.in.net
http://www.nikeairmaxuk.me.uk
http://www.poloralphlaurenuk.uk
http://www.nikeairjordans.us.com
http://www.pradashoes-outlet.com
http://www.ralphlaurenpolo.in.net
http://www.coachoutletfactoryonline.us.org
http://www.columbiashoes.us.com
http://www.outletcoachfactory.us.com
http://www.columbiaoutlet-store.com
http://www.cheap--nfljersey.us.com
http://www.louisvuittonoutlettrade.us.com
http://www.lebron13shoes.com
http://www.poloralphlaurenoutletonilne.us.com
http://www.oakleysunglassesoutletwholesale.us.org
http://www.adidas-nmdshoes.us.com
http://www.lebronjamesshoes14.us
http://www.villafranchi.it
http://www.ferragamooutlet.us.com
http://www.truereligionsale.com.co
http://www.officialcoachoutletonline.us.com
http://www.reebokshoesoutlet.us.com
http://www.nhlhockey-jerseys.us.com
http://www.salomon-shoes.in.net
http://www.coachfactory-outletstoreonline.us.com
http://www.coachoutletonlinesales.us.com
http://www.coachhandbags-onlineoutlet.us.com
http://www.funoase.at
http://www.michaelkorsbagsuk.co.uk
http://www.ray-banwayfarer.me.uk
http://www.oakleysunglasses-outlet.com.co
http://www.ferragamobelt.us.com
http://www.christianlouboutin.me.uk
http://www.chaussureschristianlouboutin.fr
http://www.prada.us.org
http://www.chelseajersey.org.uk
http://www.michael--korsoutlet.us
http://www.michaelkorsoutletcenter.us.com
http://www.columbiasportswearoutlet-inc.com
http://www.pandora-rings.net
http://www.birkenstockoutlet.us.com
http://www.michaelkorshandbagsuk.uk
http://www.converse-outletstore.com
http://www.adidasyeezy-boost.us.com
http://www.redbottoms.me.uk
http://www.ctss.se/Ray Ban.html
http://www.poloralphlaurenonlineoutlet.us.com
http://www.cheapraybans.ca
http://www.ctss.se/Nike Air Max.html
http://www.officialcoachfactoryonlinesale.us.com
http://www.michaelkorstotehandbags.us.com
http://www.cheapairjordan-shoes.us.com
http://www.coachfactoryoutletonlinesale.us.com
http://www.nikecortez.org
http://www.coach--purses.in.net
http://www.aididasyeezy.org.uk
http://www.new-balanceshoes.us.com
http://www.adidasoutletstore.net
http://www.alupro.fr
http://www.hermes.in.net
http://www.nikesoccershoes.us.com
http://www.nikeairmax2017.org
http://www.adidas-ultraboost.com
http://www.pandoraoutlet.us.org
http://www.niketrainers.uk
http://www.kevindurant9shoes.org
http://www.nikeoutletstore.us.com
http://www.vitax.se
http://www.adidasyeezy350.us.com
http://www.anzeigenmaerkte.ch
http://www.jordanshoes.us.org
http://www.ralphlaurenukofficial.org.uk
http://www.vansshoes.us.org
http://www.toryburchoutlet.net.co
http://www.fitflops.us.org
http://www.louis-vuittonoutlet.net.co
http://www.mcm.com.co
http://www.coachoutlet-storeonline.us.org
http://www.pandora-jewelry.name
http://www.macysmichaelkorshandbags.us.com
http://www.katespadehandbagssale.us.com
http://www.adidasoriginalsshoes.in.net
http://www.ferragamoshoesoutlet.us.com
http://www.michaelkorsbags.in.net
http://www.mlbjerseyswholesale.us.com
http://www.christianlouboutinonlineoutlet.us.com
http://www.outletnike.org
20176.29wengdongdong




Enter Comments^


Email addresses provided are not made available on this site.





You can use UUB Code in your posts.

[b]bold[/b]  [i]italic[/i]  [u]underline[/u]  [s]strikethrough[/s]

URL's will be automatically converted to Links


:-x :cry: :laugh: :-( :cool: :huh: :-) :angry: :-D ;-) :-p :grin: :rolleyes: :-\ :emb: :lips: :-o
bold italic underline Strikethrough





Remember me    

Monthly Archive
Responses Elsewhere



About The Schwartz

rss.jpg


All opinions expressed here are my own, and do not represent positions of my employer.