Discussion:
[saxon] Which Regex Engine does saxon9he-api.dll 9.7.0.15 use
Alex Muir
2017-04-22 15:33:25 UTC
Permalink
Greetings,

I'm wondering what regex engine saxon9he-api.dll 9.7.0.15 will use
when the ;n flag is set?

I use regex buddy to develop regular expressions. Currently I'm using
a .NET 2.0-4.6 setting. Is that an appropriate setting?

I'm doing an in memory conversion as follows. Does the in memory
conversion use a different regex than a non in memory conversion?

XSLTConversionCommand conversionCommand = new
XSLTConversionCommand()
{
PathOfInputXml = simplifiedWorkOrder,
PathOfInputXsl =
dataDictionaryRepository.GetByKey("WORK_ORDER_ANALYSIS.xsl").Value
};
IXsltConvertor xsltConvertor = new InMemoryXsltConvertor()
{
ConvertCommand = conversionCommand
};
string xml = xsltConvertor.Convert();
workOrder.AnalysisResultXml = xml;


Regards
Alex Muir
Chief Data Engineer/Architect
Jahtoe Technology
tech.jahtoe.com
Alex Muir
2017-04-22 15:59:17 UTC
Permalink
Post by Alex Muir
I'm doing an in memory conversion as follows. Does the in memory
conversion use a different regex than a non in memory conversion?
actually the code should be the following. The other code is a facade
over the Saxon API.

Saxon.Api.Processor processor = new Saxon.Api.Processor();
Saxon.Api.XsltCompiler compiler = processor.NewXsltCompiler();
Saxon.Api.DomDestination destination = new
Saxon.Api.DomDestination();
Saxon.Api.XsltExecutable executable =
compiler.Compile(xslStringAsStream);
Saxon.Api.XsltTransformer transformer = executable.Load();
transformer.SetInputStream(xmlStringAsStream, new
System.Uri(@"D:\Upwork\WorkOrderAnalysis\XSLT"));
transformer.Run(destination);
string finalOutput = destination.XmlDocument.InnerXml;



Regards
Alex Muir
Chief Data Engineer/Architect
Jahtoe Technology
tech.jahtoe.com
Michael Kay
2017-04-22 19:37:32 UTC
Permalink
When you run on .NET and use the ";n" flag, Saxon compiles and executes the regular expression using the classes in

System.Text.RegularExpressions

This won't depend on how you run the transformation.

Michael Kay
Saxonica
Post by Alex Muir
Greetings,
I'm wondering what regex engine saxon9he-api.dll 9.7.0.15 will use
when the ;n flag is set?
I use regex buddy to develop regular expressions. Currently I'm using
a .NET 2.0-4.6 setting. Is that an appropriate setting?
I'm doing an in memory conversion as follows. Does the in memory
conversion use a different regex than a non in memory conversion?
XSLTConversionCommand conversionCommand = new
XSLTConversionCommand()
{
PathOfInputXml = simplifiedWorkOrder,
PathOfInputXsl =
dataDictionaryRepository.GetByKey("WORK_ORDER_ANALYSIS.xsl").Value
};
IXsltConvertor xsltConvertor = new InMemoryXsltConvertor()
{
ConvertCommand = conversionCommand
};
string xml = xsltConvertor.Convert();
workOrder.AnalysisResultXml = xml;
Regards
Alex Muir
Chief Data Engineer/Architect
Jahtoe Technology
tech.jahtoe.com
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
https://lists.sourceforge.net/lists/listinfo/saxon-help
Alex Muir
2017-04-24 17:45:33 UTC
Permalink
Thanks,, and that is what regex buddy is using as well
Post by Michael Kay
When you run on .NET and use the ";n" flag, Saxon compiles and executes the regular expression using the classes in
System.Text.RegularExpressions
and to confirm the ignore case flags="i;n" should work correct with
that syntax?

<xsl:analyze-string select="." regex="{$regex.hvac.problems.B}" flags="i;n">

Currently my regex are only working lower case.


Regards
Alex Muir
Chief Data Engineer/Architect
Jahtoe Technology
tech.jahtoe.com
Michael Kay
2017-04-24 21:24:33 UTC
Permalink
Post by Alex Muir
Thanks,, and that is what regex buddy is using as well
Post by Michael Kay
When you run on .NET and use the ";n" flag, Saxon compiles and executes the regular expression using the classes in
System.Text.RegularExpressions
and to confirm the ignore case flags="i;n" should work correct with
that syntax?
Interesting. I think the ";n" option was introduced in 9.5, and in all releases since 9.5 the code in DotNetRegularExpression.setFlags() reads:

case 'i':
// flags |= RegexOptions.IgnoreCase;
break;

Note the commenting out of the relevant line. I've absolutely no idea why it's commented out. We will have to do some tests before reinstating it. I will raise a bug entry.

Michael Kay
Saxonica
Post by Alex Muir
<xsl:analyze-string select="." regex="{$regex.hvac.problems.B}" flags="i;n">
Currently my regex are only working lower case.
Regards
Alex Muir
Chief Data Engineer/Architect
Jahtoe Technology
tech.jahtoe.com
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
https://lists.sourceforge.net/lists/listinfo/saxon-help
Alex Muir
2017-04-24 22:46:35 UTC
Permalink
Post by Michael Kay
// flags |= RegexOptions.IgnoreCase;
break;
Note the commenting out of the relevant line. I've absolutely no idea why it's commented out. We will have to do some tests before reinstating it. I will raise a bug entry.
More than interesting really,, is that approximately 4 years old?

I'd be happy to test a dll with that uncommented. I'm supposed to demo
the development end of day Tuesday. I'll bet lunch that it will have
no negative effect. Well I hope anyway!

Actually I suppose I can Install-Package Saxon-HE -Version 9.4.0.9 in
the mean time.


Regards
Alex Muir
Chief Data Engineer/Architect
Jahtoe Technology
tech.jahtoe.com
Alex Muir
2017-04-24 22:50:35 UTC
Permalink
Post by Alex Muir
Actually I suppose I can Install-Package Saxon-HE -Version 9.4.0.9 in
the mean time.
Oh but will the code I pasted earlier work with 9.4 I wonder? I'll
test in the morning..

Regards
Alex Muir
Chief Data Engineer/Architect
Jahtoe Technology
tech.jahtoe.com
Michael Kay
2017-04-25 07:09:09 UTC
Permalink
I traced back and I think ";n" was introduced in 9.5.

Testing will be trivial - it's doing a .NET build containing the change that takes time.

Michael Kay
Saxonica
Post by Alex Muir
Post by Alex Muir
Actually I suppose I can Install-Package Saxon-HE -Version 9.4.0.9 in
the mean time.
Oh but will the code I pasted earlier work with 9.4 I wonder? I'll
test in the morning..
Regards
Alex Muir
Chief Data Engineer/Architect
Jahtoe Technology
tech.jahtoe.com
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
https://lists.sourceforge.net/lists/listinfo/saxon-help
Alex Muir
2017-04-25 09:16:49 UTC
Permalink
Post by Michael Kay
I traced back and I think ";n" was introduced in 9.5.
Good point. I tried and can confirm that I can't use 9.4 with the
regular expressions I've written which do need the ;n


Regards
Alex Muir
Chief Data Engineer/Architect
Jahtoe Technology
tech.jahtoe.com

Loading...