On Sun, 31 Oct 1999 [EMAIL PROTECTED] wrote:

> 
> Lookin' for help again...
> 
> I am building up a parser for XML, and now that I know how to use 'parse' it
> is actually a  straightforward matter of taking the production rules out of
> the XML spec and putting them in Rebol.
> 
> But I need to be able to test that a string conforms to a set of characters.
> For instance, that a string contains any valid character except some special
> characters which are not allowed un-escaped in XML, like ampersand and
> less-than.


Just in case you didn't know, there already is an XML parser in
Rebol. :-) (but it's not a validating parser)

>> help parse-xml
Parses XML code and returns a tree of blocks.
Arguments:
    code -- XML code to parse (string)



> It feels like there should be an easy way to build a charset, and them maybe
> do arithmetic on it using 'difference'.
> 
> You know how you can do this...
> 
> allowable: charset [#"A" - #"Z"]
> 
> well I really want to be able to something do this:
> 
> allowable: charset [#00 - #FF]
> 


Try this:

>> charset [#"^(00)" - #"^(FF)"]


> Conceptually what I want is:
> 
> allowable: charset difference ['set of all chars'] [#"&" #"<"]
> 


Something like this?

>> difference charset [#"^(00)" - #"^(FF)"] charset [#"&" #"<"]

Or even easier:

>> complement charset [#"&" #"<"]



/Martin Johannesson, [EMAIL PROTECTED]

Reply via email to