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

Re: Need an XPath expression which returns all xs:patt

Subject: Re: Need an XPath expression which returns all xs:pattern elements containing a regex that permits an unbounded number of characters
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 4 Apr 2024 14:52:00 -0000
Re:  Need an XPath expression which returns all xs:patt
On Thu, 4 Apr 2024 at 15:38, Piez, Wendell A. (Fed) wendell.piez@xxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Holla again,
>
>
>
> With every reason to trust David C, nonetheless wouldnbt it be fine if we
> could, say, set up a bunch of unit tests to actually determine which of
> these subtle incantations do as we think they do?
>
>
>
> An XSpec sheet could be wired to test both regex-based and parsing-based
> solutions as implemented in XSLT, to give Roger the confidence he needs in
> his approach.
>
>
>
> I jump in to mention of XSpec mainly because these questions are
> surrounded by the problem of whatbs beasyb. It depends. Maybe
paper-napkin
> analysis followed by some interactive free-form testing is good enough.
>
>
>
> Cheers, Wendell
>


Oh now I'm hurt that you suggest Roger may fear a typo in my famously
accurate typing:(

Actually I suspect the real question is not "is this well tested" it's "why
are you asking this question"?

I suspect it's really not the right question to be asking.

For example if * and + are being banned to disallow some long strings as
part or preventing some DOS attack then
a finite string match such as x{0,100000000000000000000000}  is likely to
be just as problematic.
so a well tested accurate test for really infinite matches may not really
help




>
>
> *From:* David Carlisle d.p.carlisle@xxxxxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
> *Sent:* Thursday, April 4, 2024 10:21 AM
> *To:* xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> *Subject:* Re:  Need an XPath expression which returns all
> xs:pattern elements containing a regex that permits an unbounded number of
> characters
>
>
>
>
>
>
>
> On Thu, 4 Apr 2024 at 14:48, Willem Van Lishout willemvanlishout@xxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Is this even possible, theoretically speaking? As soon as you start using
> lookaheads, square brackets, and so on, your patterns will likely fail. I
> don't think regex can parse regex.
>
>
>
>
>
>
>
> I don't think the regex needs to be parsed here: you can destructively
> normalise it before testing eg
>
> replace ( replace(replace(,.'\s','') , '\\.' , 'x'), `\{-0-9]*,\}`,'*`)
>
>
>
> would get rid of all white space, replace  \-quoted characters by x and
> a{ 99, } constructs by a*
>
> which should simplify looking for * and +
>
>
>
> David
>
>
>
> 4 Apr 2024, at 20:15, "David Carlisle d.p.carlisle@xxxxxxxxx" <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>
>
>
>
> On Thu, 4 Apr 2024 at 13:29, Roger L Costello costello@xxxxxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi Folks,
>
> I want to find, in an XML Schema, all xs:pattern elements containing a
> regex that permits an unbounded number of characters.
>
> Here are examples of xs:pattern elements that I want to find:
>
> <xs:pattern value="A*"/>
> <xs:pattern value="A+"/>
> <xs:pattern value="A{0,.}"/>
> <xs:pattern value="A{1,.}"/>
>
>
> How to fix my XPath expression? Is the solution to add a second predicate:
>
> xs:pattern[
>         contains(@value, '*') or
>         contains(@value, '+') or
>         contains(@value, '{1,}') or
>         contains(@value, '{0,}')
>     ][
>         not(contains(@value, '\*')) and
>         not(contains(@value, '\+'))
>     ]
>
> Is that correct?
>
>
>
> No.
>
>
>
> A  pattern \\*   matches an unbounded list of backslashes  but fails your
> test as it contains \*
>
> A pattern X{5,}  matches an unbounded list  of X of at least 5 but doesn't
> match your first predicate.
>
>
>
>
>
>
>
>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/3166594>
> (by email)
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2739265> (by
> email)
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/3302254> (by
> email)
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2739265> (by
> email <>)

Current Thread

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
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.