XPLT: eXtensible Parser Language Transformations
secretGeek .:dotnuts about dotnet:.
home .: about .: sign up .: sitemap .: secretGeek RSS

XPLT: eXtensible Parser Language Transformations

When you dream of software regularly, it's a bit of a worry. Anyhow, this is an idea I had while mowing the lawn today. I think it could really speed things up interconnecting legacy systems with the XML-aware world. What do you think?

XPL: completes the transformation cycle

XPLT borrows from XSLT and Regular Expressions (RE), but also provides a more human-readable style of Pattern-Matching, encapsulated within the Pattern element. Patterns are combined with templates and flow control semantics, that allow for very flexible document transformations.

XPL Transformers could be written on any platform, for any technology. Collections of specific and re-usable XPL documents for converting between any two text-formats could be shared and distributed.

Underlying principles of XPL

  1. Human Readable
  2. Not concerned with Terseness
  3. Platform Independent
  4. Transport Indepedent
  5. XPL documents are valid XML documents

How is it used?

Here are some typical scenarios for which XPLT is useful.

  • EDI documents, containing data in fixed-width fields, need to be converted to XML for transmission to a web service
  • A legacy system produces CSV documents. They can be converted to XML using XPLT.
  • A trading partner produces XML documents that are not always well-formed. They can be 'pre-processed' with XPLT to produce well-formed XML.
  • An RSS aggregator receives some documents that are in an obscure format. They can be transformed to valid RSS using XPLT
  • A HTML doc needs to be parsed to retrieve certain values.
  • VB.net code needs to be changed into C#
  • HTML code includes embedded font tags. It needs to be altered to use CSS.
  • Wiki Text needs to be converted to xHTML.
  • A regular expression needs to be converted into a human-readable explanation
[Read on for further details]

These problems can be solved by writing custom parsers, or, at best, through clever use of Regular Expressions.

Maintenance of such code can prove remarkably expensive. Why?

  • System boundaries are *always* in a state of flux.
  • Custom parsing is notoriously buggy -- even if it runs error-free for six months, you know there is a chance that an unexpected character combination could upset it.
  • Regular Expressions are deliberately terse. This limits the number of developers who take the time to master them.
  • The platform and underlying technology of a system boundary can change. Any platform or technology dependent code then needs to be rewritten completely.

Features of the Language

The main features of the language are:

  • the Pattern
  • flow control
  • the replace construct
  • the template

From XSLT it borrows elements used for these constructs:

  • If/else statements
  • Choose statements
  • for-each
  • Sort

In XSLT, the 'Match' and 'Select' attributes reference an Xpath expression. In XPLT the equivalent attributes reference a named Pattern element.

The Pattern Element

A pattern element serves a purpose analogous with a Regular Expression (RE). It can, infact, be simply a RE, for example:

[Thanks to Darren Neimke for the RE example, taken from RegExLib.]

Any such pattern can also be expanded using the far more verbose pattern semantics of XPLT.

Okay - the names Char, Chargroup etc, are pretty ugly. But I've just invented them now. The structure of those pieces could be altered and improved, I am sure. Just food for thought. Rather than

You could just say:

And Rather than

You could just say:

I guess you would also have 'greedy' and/or 'non-greedy' attributes.

Here's the original picture I came up with -- the complete loop converting proprietary text into XML by using XPLT. Then converting the XML back into properietary text, by way of XSLT.

closing the transformation cycle

I'm damn tired now -- so i'll stop there. Cheers!

Disambiguation

XPL is not any of the following:

  • A language for writing compilers.
  • A scripting language for the Note Bene word processor.
  • A MIDI programming language for Amiga.
  • A language called eXtensible Programming Language.
  • A Pascal-like language named XPL0.

Add or view comments about this page

Articles

Do they store the code for TFS in TFS? Do they store the code for TFS in TFS?
Sudden TimeSnapper Discount! Sudden TimeSnapper Discount!
How Can Microsoft Beat Google? How Can Microsoft Beat Google?
TimeSnapper 3.1: Attack of the the Red/Green Stripes TimeSnapper 3.1: Attack of the the Red/Green Stripes
21 tools used in our MicroISV 21 tools used in our MicroISV
Lost Treasures of the DOS World: tree! Lost Treasures of the DOS World: tree!
The Virtual Machine Machine and the Virtual Virtual Machine The Virtual Machine Machine and the Virtual Virtual Machine
Should Linq To Sql Go Should Linq To Sql Go "Open Source"?
Redux: New Synchronisation Idea Overlooked By Microsoft Redux: New Synchronisation Idea Overlooked By Microsoft
New Synchronisation Idea Overlooked By Microsoft Live team New Synchronisation Idea Overlooked By Microsoft Live team
Visual Studio UX Taskforce, Office UX Taskforce... etc. Visual Studio UX Taskforce, Office UX Taskforce... etc.
How to be Jeff Atwood How to be Jeff Atwood

Archives .: secretGeek :: Complete Archives :.
25 steps for building a Micro-ISV 25 steps for building a Micro-ISV
3 minute guides -- babysteps in new technologies: powershell, JSON, watir, F# 3 Minute Guide Series
Top 10 SecretGeek articles Top 10 SecretGeek articles

Downloads

TimeSnapper -- Automated Screenshot Journal TimeSnapper.com    
Version 3.1: instant productivity profiles

ShinyPower (help with Powershell) ShinyPower
Now at CodePlex

Next Action NextAction
Managing the top of your mind



[powered by Google] 


Thai Erawan, Brisbane Restaurant, delicious thai food in paddington Thai Erawan, Brisbane Restaurant
World's Simplest Code Generator (html edition) World's Simplest Code Generator
Gradient Maker -- a tool for making background images that blend from one colour to another. Forget photoshop, this is the bomb. Gradient Maker
How to be depressed How to be depressed
You are not inadequate.



Recommended Reading

The Best Software Writing I
The Business Of Software (Eric Sink)

Recommended blogs

Jeff Atwood
Reginald Braithwaite
Joseph Cooney
Phil Haack
Scott Hanselman
Julia Lerman
Joel Pobar
Eric Sink
Joel Spolsky
Des Traynor

Aggregated Links

programming.reddit.com
dzone
dot net kicks

Human Link Machines

interesting finds
a continuous learner's weblog
arjan's world
n links today
new and notable
morning coffee
learning .net
weekly link post
(my del.icio.us account)

LinkedIn profile
 
home .: about .: sign up .: sitemap .: secretGeek RSS .: © Leon Bambrick 2003 .: privacy

home .: about .: sign up .: sitemap .: RSS .: © Leon Bambrick 2003 .: privacy