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

Re: Globbing versus Regular Expressions (was: Regular Associat


globbing syntax
> >- it does a different thing: XPath is a language for 
> >addressing parts of
> >  a document, Relax NG, and the way it is used in ARX, the 
> >utility we are discussing,
> >  assesses that a document matches a regular pattern. 
> 
> If you wrap boolean() around your XPath expressions and limit them to
> expressions that evaluate to a node set then you have the same thing. 

Dare, no, I don't have the same thing. It will still be a language
for addressing part of a documents used to identify a document's
type based on presence or absence of certain parts. 

The difference is not in boolean(), or what it evaluates to. 
The difference is closure. If 'a' and 'b' are regular expressions,
then 'a op b' is a regular expression too. 

Having file globbing syntax for XPath is convenient in limited cases.
It can be an obstacle in others, and there is no reason why XPath,
a limited addressing syntax, should be adopted for matching.

To check whether a particular document is DocBook Website XML, one
writes (in relax ng compact):

element webpage {attribute *{text}|(element head {any},dbbookcontent}

('any' and 'docbookcontent' are defined elsewhere). The equivalent
in XPath requires writing in square brackets an algorithm required 
to interpret a part of this expression, and the more things one combines,
the more program code has to be embedded into the XPath expression.

One can find an application where augmenting a regular xml grammar with
computations is useful, but for the purpose of classifying documents
a regular syntax is powerful enough to go alone.

XPath's patterns alone are not powerful enough. They require augmenting
with predicates, that is, with snippets of code which compute functionally
things xpath's syntax cannot express declaratively.

Having a formalism that does the job is, in my opinion, better
than having a  combination of less powerful formalism (paths) that does not, 
and another formalism (predicates) to patch the former.

> >Note 1. However, I would find an XSLT-like language  that 
> >provides XML regular expressions (similar to Relax NG) for 
> >matching and selection more useful and convenient, if 
> >occasionally less verbose, than XSLT; if string regular 
> >expressions (which are peripheral to the area of XSLT) were 
> >added, why XML regular expressions were not?
> 
> Sounds like XQuery. 

Not at all. Regular expressions don't have 'Q|y' in their name, while
XQuery does. Why do you think they sound similar?

David Tolpin

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.