How to define a "blacklist" schema type?

P

Peter Wang

Hi all,
I want to write a schema file to validate my xml file, and
encounter a problem as follow.
the xml file contains a <path> node£¬whose value should be a string not
included by a blanklist(for instance, {"/bin", "/root", "/usr"}), how
to define a "blanklist" type use simpleType to
implement this, or any other advices?
Thanks !!
 
J

Joe Kesselman

Enumeration won't do it, since you want to enumerate the forbidden
values. You might be able to get this via regular expressions... or it
might make more sense to just check it in the application rather than in
the schema. Given your examples, I suspect that this may actually wind
up wanting to be decided on a per-installation or per-user basis, which
would be another reason to keep it in the application rather than the
schema.
 
P

Peter Wang

Enumeration won't do it, since you want to enumerate the forbidden
values. You might be able to get this via regular expressions... or it
might make more sense to just check it in the application rather than in
the schema. Given your examples, I suspect that this may actually wind
up wanting to be decided on a per-installation or per-user basis, which
would be another reason to keep it in the application rather than the
schema.

thanks for your reply.
Using regular expressions to describe such a "blacklist" is too hard.
Actually, I use an xml as the configure file of my application,
the configuration validation and the configuration loading are
seprated,
so i must do the restriction at the stage of configuration validation.
 
J

Joseph Kesselman

Peter said:
Using regular expressions to describe such a "blacklist" is too hard.

The only alternative I can think of is application code. I'd love to be
wrong about that. Good luck...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top