[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: An XML API using Java streams

  • From: John Cowan <johnwcowan@gmail.com>
  • To: Hans-Juergen Rennau <hrennau@yahoo.de>
  • Date: Thu, 22 Jun 2017 10:14:54 -0400

Re:  An XML API using Java streams

On Thu, Jun 22, 2017 at 9:11 AM, Hans-Juergen Rennau <hrennau@yahoo.de> wrote:

(3) I do not think that an embedded expression language is per se inferior to using Java primitives. In fact, it can be an incomparably better choice. Proof: nobody would consider replacing regular expressions by calls to a Java-native "API for string navigation" (streaming or not).


The irregex library for the programming language Scheme uses just such combinators, and has been taking over the world of Scheme regular expression implementations.  Originally it was just an overlay on PCRE, but is now written entirely in Scheme — and with a good compiler is competitive with existing C implementations.  Classic regex language is more terse, yes.  But combinators are clearer, do not require two-level escapes (and so lack a whole class of vulnerabilities), and are readily extensible as needed.

Here's what irregex matching might look like in a fluent Java syntax:

sequence(exactly(3, n_to_m(numeric, 1, 3), "."),
              n_to_m(numeric, 1, 3))

where "numeric" is a standard character-set object representing [0-9].  This match will return true, whereas one against "192.0168.10.1" or "192.168.10" or "not an IPv4 address" will return false.

For more on irregex, see the latest spec at <http://srfi.schemers.org/srfi-115/srfi-115.html>.

(ObSmugLispWeenie:  Of course, Lisp languages have had garbage collection since 1960 and closures since 1975.  Perhaps in a few decades Java regular expressions will catch up as well.)

John Cowan          http://vrici.lojban.org/~cowan        cowan@c...
A poetical purist named Cowan                   [that's me]
Once put the rest of us dowan.                  [on xml-dev]
"Your verse would be sweeter / If it only had metre
And rhymes that didn't force me to frowan."     [overpacked line!] --Michael Kay

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.