VSoft Technologies Blogs

rss

VSoft Technologies Blogs - posts about our products and software development.

New XML Actions

I'm now into my fourth month here at VSoft, so it must be about time for a first blog post!

I've been working on all kinds of new actions for FinalBuilder 4. I think lots of you who requested features will be very happy with the upcoming release (and everyone else should find something useful, too.)

Today I just wanted to demonstrate two new XML actions : the XML Iterator and the XML Read from Variable Action. Combined with the already strong XML support in FinalBuilder, you can work with data from almost any XML file. Allow me to demonstrate:

Here's the project:

The XML file I'm iterating is a 3Mb chunk of the Javanese edition of the Wikipedia, exported as XML. I'm going to catalogue all the users who made edits, and record their usernames as well as any comments they recorded. I don't want to record revisions by the automatic MediaWiki bots.

So, I iterate through the XPath /mediawiki/page/revision, saving the absolute XPath in to each revision in the 'Page' FinalBuilder variable:

 

Once I have the absolute XPath to each node, I can read the 'Comment' and 'Contributor' tags into FinalBuilder variables. Here's the action which reads 'Comment':

The 'Comment' tag is optional, so I use a Try... Catch block to blank out the comment if there isn't one.

Together with a 'Write Text File', these actions are all you need to create a list of contributors and their comments.

This sort of technique can be used to parse any kind of XML file as part of your build process. If you need to, you can even create an XML file which gives instructions to your build process. But who'd want to do that?

Showing 0 Comment


Comments are closed.