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

Fwd: Re: A XSD regex to allow a QName in Clark form

  • From: Rick Jelliffe <rjelliffe@allette.com.au>
  • To: xml-dev@lists.xml.org
  • Date: Sat, 16 Sep 2017 00:50:29 +1000

Fwd: Re:  A XSD regex to allow a QName in Clark form
---------- Forwarded message ----------
From: "Rick Jelliffe" <rjelliffe@allette.com.au>
Date: 15 Sep 2017 11:34 AM
Subject: Re: A XSD regex to allow a QName in Clark form
To: "Christophe Marchand" <cmarchand@o...>
Cc:

Why not elaborate them? Trying to get the minimal regex is a mug' s game, and bad for maintainability unless by accident there is a simplification. Better to be explicit about each pattern:

So something like:
(CLARK)|(XSLT3)|(QNAME)

Where (assuming you are already tokenizing the string by whitespace)
  CLARK is   \{[^\{\}]+\}[^:]+
  XSLT3  is  Q\{[^\{\}]+\}[^:]+
  QNAME is [^:]+:[^:]+

You get the idea: they are a little simplified, of course.  It depends on whether you want regexes for parsing or for validating.

Regards
Rick

On 14 Sep 2017 19:17, <cmarchand@o...> wrote:
As I use this value to create a new net.sf.saxon.s9api.QName, via constructor and factory methods, I'm gonna check this.
Thanks a lot for this precises explanations.

Best regards,
Christophe



Le 2017-09-14 11:04, Michael Kay a écrit :
Some more precise terminology might help.

Clark notation is described here:

http://www.jclark.com/xml/xmlns.htm

and uses the notation "{uri}local" for a name that is in a namespace.
That page doesn't define a corresponding notation for a name in no
namespace, but it would be wise to accept either "local" or "{}local"
unless specified otherwise. The JAXP API (for example
Transformer.setParameter) uses Clark notation (without naming it) and
says that "local" should be used for a no-namespace name: it does not
allow "{}local".

XPath 3.0 introduces a similar syntax. An EQName is either a (lexical)
QName (format: (prefix:)?local ), or a URIQualifiedName, format

"Q" "{" [^{}]* "}" NCName

which is equivalent to the regex

Q\{[^{}]*\}\i\c*

This format explicitly allows a no-namespace name to be written as
Q{}local.

Michael Kay
Saxonica

On 14 Sep 2017, at 08:56, yamahito <yamahito@gmail.com> wrote:
Try
<xs:pattern value="Q?\{[^\}]+\}[^:\{\}]+"/>
?

On Thu, 14 Sep 2017 at 7:55 am, <cmarchand@oxiane.com> wrote:

Hi !

I'm not a regex killer, especially when regex flavour is not the
one I
use on my linux box...

In a schema, I need a simple type that allows a QName, written
either
"prefix:localName" or in ClarkeForm "Q{nsUri}localName", or in
the-last-one-I-cant-remember-the-name "{nsUri}localName"

I've started with the one available in XSD schema :

<xs:simpleType name="QName">
<xs:annotation>
<xs:documentation> A QName. This schema does not use the
built-in
type xs:QName, but rather defines its own QName type. Although
xs:QName
would define the correct validation on these attributes, a schema
processor would expand unprefixed QNames incorrectly when
constructing
the PSVI, because (as defined in XML Schema errata) an unprefixed
xs:QName is assumed to be in the default namespace, which is not
the
correct assumption for XSLT. The data type is defined as a
restriction
of the built-in type Name, restricted so that it can only contain
one
colon which must not be the first or last character. TODO: change
implementation to allow use ClarkeForm </xs:documentation>
</xs:annotation>
<xs:restriction base="xs:Name">
<xs:pattern value="([^:]+:)?[^:]+"/>
</xs:restriction>
</xs:simpleType>

But my pattern for ClarkeForm isn't correct :
<xs:pattern value="Q?\{[^\{]+\}[^:\{\}]+"/>

Any help will be appreciated.
Thanks in advance,
Christophe



_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines:
http://www.oasis-open.org/maillists/guidelines.php

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php


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


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.