OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

relax-ng message

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


Subject: [relax-ng] Proposal for a regex module, draft 0.1


I ran with James's idea in the telcon today about expressing regexes
via the existing element set.  I propose the following schema
for them.  Note that this is an annotation rather than a change in RELAX NG.

default namespace = "http://relaxng.org/ns/structure/1.0"
namespace r = "http://relaxng.org/ns/structure/regex/1.0"

start = element r:regex {foreign, regex}

regex =
	element oneOrMore | zeroOrMore | optional | choice | group
		{foreign & regex+} |
	element value {foreignAttribute*, string} |
	anyChar

anyChar =
	element r:anyChar {
		((attribute from {string}, attribute to {string})? |
		attribute charType {string})?,
		foreign & element except {foreign & anyChar+}

foreign = foreignAttribute*, foreignElement*

where foreignAttribute and foreignElement are as in RELAX NG.

The r:regex element can be a child of data (for regular expressions
in content/attribute values) or of anyName/nsName (to specify a
local-name-part via a regular expression).

The r:anyChar element matches any character if there are no
attributes.  It matches any character between "from" and "to"
(single characters) if these attributes are present.  It matches
any char in a named class such as "Ps" or "IsDevanagari" if the charType
attribute is present.  The except child element allows subtraction;
for example, "[^A-Z]" is <anyChar><except><anyChar from="A" to "Z"/>
</except></anyChar>.

Comments?

-- 
John Cowan           http://www.ccil.org/~cowan              cowan@ccil.org
To say that Bilbo's breath was taken away is no description at all.  There
are no words left to express his staggerment, since Men changed the language
that they learned of elves in the days when all the world was wonderful.
        --_The Hobbit_


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


Powered by eList eXpress LLC