Search DominoPower's 11,443 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Parsing XML with LotusScript and Microsoft's XML object (continued)

Installing and loading MSXML
Sadly, I haven't found a way of just installing the MSXML component by itself. MSXML only gets installed when you install Internet Explorer 5 or there is an earlier version in Internet Explorer 4. It also doesn't come with any documentation but there are books available (see the Product Availability and Resources section at the end of this article). There's also a comprehensive online tutorial on the Microsoft site. Once installed (you'll probably need to fully install IE5), try running the following agent:

Dim xml As Variant
Set xml = CreateObject("Microsoft.XMLDOM")
Msgbox xml.async

You should get the message 'True' when you run this. If you get an error, try re-installing Internet Explorer.

You can find this agent included as SimpleTest in the sample database. Download instructions are in Product Availability and Resources at the end of this article.

The initial XMLHeadlines agent
I created a simple database with a single document called News. This had two rich-text fields, one for the XML original and one for my HTML output. My first agent, XMLHeadlines, would download an XML file, place the contents in the XML field, and parse the data. I would then walk the tree to get the information I wanted and wrap that in HTML. Luckily MSXML allows you to load a file from a local source, so I didn't have to spend loads of time online while I was debugging it.

There are a number of key pieces of the agent. Table A contains a list of code segments and descriptions.

Code segment Description
Set xml = CreateObject("Microsoft.XMLDOM"). Creates an instance of the object in a variant.
xml.async=False Default is asynchronous loading. We need synchronous so it waits for the file. To speed up loading set validateOnParse=false as well so it simply checks for "well-formedness".
xml.load(URL or file name) Loads a file or a URL. Returns true or false.
originalfile$=xml.xml Returns the original XML as a string
title=xml.selectSingleNode("rdf:RDF/channel/title").text Get the value of a single node as a text string; returns DominoPower News Center in listing above.
set root=xml.selectNodes("rdf:RDF/item") Return a node list matching the given pattern (i.e. all the item nodes). Use Forall to run through the list.
link$=x.childNodes(1).text For each node in the node list, get the first child nodes' value; returns the link item in listing above. You can use x.childNodes(1).nodeName to get the name.

This worked pretty well and gave me the data I wanted. However, I also wanted to try and use style sheets as an alternative. The advantage of style sheets is that you can have one XML file and get different outputs depending on which style sheet you use. This is a bit like using different sub-forms in a form.


« Previous  ·  1  ·  2  ·  3  ·  Next »
Other articles you might like
Home > Internet Technologies > XML (11 articles)
   How to create a Web service to extract data from XML documents
   Building an XML based Content Management System using Lotus Domino: wrapping it up
   Building an XML based Content Management System using Lotus Domino: overview of the content administration system
Home > Microsoft Technologies (30 articles)
   Making Domino work with IIS
   Preparing for the impending IE7 release
   How to create animated, context sensitive help for the Notes client
Home > Internet Technologies > RSS and blogging (11 articles)
   Integrating AJAX and RSS into Domino applications
   Introducing the DominoPower RSS feeds
   Bridging the communications gap with RSS
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Syncing Notes with Android phones
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Online safety for virtual learning
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Seek and find: Strategies to locate filed-away emails fast
-- Advertisement --

Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done. Native to Lotus Domino. The User Experience unseen for Lotus Domino. Do more with less. Really.

See the possibilities Docova unleashes for Lotus Domino.
-- Advertisement --

Teamstudio Edition 25 has shipped
It's finally here! Now that Teamstudio Edition 25 has shipped, listen to our latest Tool Time audio program to find out what's changed. Updates to all your favorite Teamstudio tools will be discussed.

Plus, you'll get an introduction to Teamstudio Undo (formerly known as Teamstudio Snapper).

Tap here to get started!

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login