Re: xsd regular expression query



On 30 Mar, 14:30, ror...@xxxxxxxxx wrote:
On Mar 30, 2:02 pm, Bjoern Hoehrmann <bjo...@xxxxxxxxxxxx> wrote:





* ror...@xxxxxxxxx wrote in comp.text.xml:

I have a regular expression that allows only certain characters to be
valid in an xml doc as follows:

<xs:pattern value="^[ dgHhMmstyf,\-\./:;\\]*" />

What I want to do is also allow any unicode character that is enclosed
in single quotes to also be valid, no matter where they appear. I
tried the following:

<xs:pattern value="^[ dgHhMmstyf,\-\./:;\\]*('*)*" />

But this only works if the characters in quotes appear after the other
text.

You are looking for "(a character from a certain set, or the character '
followed by zero or more characters except the character ' followed by
the character ') zero or more times", i.e. something like

([a-z]|'[^']*')*

if the first set of characters was a-z.
--
Björn Höhrmann · mailto:bjo...@xxxxxxxxxxxx ·http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 ·http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 ·http://www.websitedev.de/

Not quite - I want to allow the character(s) in quotes to be able to
appear with the character(s) from the specified set but not in any
particular place i.e. not necessarily at the beginning or end. For
example, I want the following to be valid:

dddd, d. MMMM yyyy
dddd, d. MMMM MyYear
MyDay, d. MMMM yyyy
dddd, d. MyMonth yyyy

so MyDay, MyYear and MyMonth appear in single quotes in the xml file
and are valid.- Hide quoted text -

- Show quoted text -

It looks to me that Björn's pattern achieves this. (Which filling in
the dots would be:

(^[ dgHhMmstyf,\-\./:;\\]|'[^']*')*

Can you do a test program and show some examples where it does not
work?

Cheers,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx/
http://www.codalogic.com/lmx/
=============================================

.



Relevant Pages

  • Re: xsd regular expression query
    ... valid in an xml doc as follows: ... in single quotes to also be valid, ... You are looking for "(a character from a certain set, ... MyYear and MyMonth appear in single quotes in the xml file ...
    (comp.text.xml)
  • Re: Putting a "<" in an attribute value (was about CDATA sections)
    ... > are ambiguous (section 2.4 essentially says numeric character ... is a lawyer :-) XML has inherited these definitions with very few ... Once validity is established, an application will receive ... <!DOCTYPE header [ ...
    (comp.text.xml)
  • Re: Future of LISP. Alternative to XML. Web 3.0?
    ... I didn't realize it meant literally the cr character within the ... instead of XML representation for queries and responses. ... using s-expressions instead of XML, nobody is going to use it, ... Do *any* of those LISP projects have a server I ...
    (comp.lang.lisp)
  • RE: System.ArgumentException: Illegal characters in path
    ... But I don't use any xml string at all in my web ... It is a default data type string and I wonder it ... cannot accept latin character since string accepts all utf-8 characters. ... Microsoft XML 3.0 SP1 ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Suppressing character entity transformation
    ... I was gently chastizing Pavel for a minor stylistic point. ... When XSLT reads in a document, character references and entity references are expanded; when it writes the document back out as either XML or HTML, it should re-create character references where they're necessary. ... You really want to fix that, along the lines he illustrated (issuing actual elements rather than text that looks like tags) before you do anything else. ...
    (comp.text.xml)