* Christian Glahn via RT (bug-XML-LibXML@rt.cpan.org) [080412 11:06]:
XML::Compile does validation (optional) under fly, when parts of the
final message are under construction. At that time, I would like to
be able to check the validity of schema simpleType values which have
a restriction facet "pattern".
I tried to translate the pattern into a regex, but XML does not use
unicode classes to define what it accepts. XML::RegExp does define
the codes explicitly, but using those will be far too slow. So, I
would really like to be able to validate against libxml2.
Show quoted text> I don't think that drafting an interface to the character validation API
> should be too much of a problem. For the other APIs it requires a closer
> look.
Judgin by name, it looks like xmlPatterncompile and xmlPatternMatch would
do the job. Although I do not know whether character check patterns
are the same as XPath patterns.
Something along the lines of:
use XML::LibXML::Common qw/compile_pattern pattern_matches/
my $pat = compile_pattern XSSEL => '\c';
if(pattern_matches $pat, $token) {...}
However, I do expect the patterns the show-up in the Schema Facet
check page...
http://xmlsoft.org/html/libxml-xmlschemastypes.html
Today, I have no time to read the C source to find where the
schema implementation check patterns...
We do not need interfaces to the other facets, because they are
simple in regexes.
--
Regards,
MarkOv
------------------------------------------------------------------------
Mark Overmeer MSc MARKOV Solutions
Mark@Overmeer.net solutions@overmeer.net
http://Mark.Overmeer.net http://solutions.overmeer.net