saxon

In Saxon 9 he Java XML parser, word boundaries (\\b) in regular expressions are not recognized

蓝咒 提交于 2019-12-01 01:19:18
I have the following simple regular expression: \b\w+\b Saxon reports the following error: syntax error at char 2 in regular expression: Escape character 'b' not allowed Does it mean I can't use word boundaries with Java Saxon parser? Is there an alternative free XML Java parser that has this functionality? The regular expression dialect used in XSD and XPath does not recognize \b (either as a word boundary or as a backspace). I think the reason for excluding it was probably a misplaced anxiety that word boundaries are language/culture dependent, though that's illogical since the dialect does

Can XSLT execute a shell script at the OS level?

a 夏天 提交于 2019-12-01 00:53:26
I have a production flow that combines XSLT and some shell scripts in about 4 steps before it reaches completion. I execute each step manually at the moment. I'm using Saxon 9 from the command line in Linux. Can I have the xsl's execute shell scripts.. instead of me? (I know I could achieve the desired result in another way with Ant or Make.. but prefer to stay in XSLT if it is not a huge effort to do so) Update : I've minimized my shell scripts and sped things up using Xproc. I'm not entirely satisfied with the result, but Xproc has improved life. Kai's suggestion below looks good.. but I

java.lang.OutOfMemoryError while transforming XML in a huge directory

♀尐吖头ヾ 提交于 2019-11-30 21:31:08
I want to transform XML files using XSLT2, in a huge directory with a lot of levels. There are more than 1 million files, each file is 4 to 10 kB. After a while I always receive java.lang.OutOfMemoryError: Java heap space. My command is: java -Xmx3072M -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEna bled -XX:MaxPermSize=512M ... Add more memory to -Xmx is not a good solution. Here are my codes: for (File file : dir.listFiles()) { if (file.isDirectory()) { pushDocuments(file); } else { indexFiles.index(file); } } public void index(File file) { ByteArrayOutputStream outputStream = new

java.lang.OutOfMemoryError while transforming XML in a huge directory

瘦欲@ 提交于 2019-11-30 17:14:43
问题 I want to transform XML files using XSLT2, in a huge directory with a lot of levels. There are more than 1 million files, each file is 4 to 10 kB. After a while I always receive java.lang.OutOfMemoryError: Java heap space. My command is: java -Xmx3072M -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEna bled -XX:MaxPermSize=512M ... Add more memory to -Xmx is not a good solution. Here are my codes: for (File file : dir.listFiles()) { if (file.isDirectory()) { pushDocuments(file); } else {

xslt 3.0 json-to-xml and xml-to-json conversion

自古美人都是妖i 提交于 2019-11-30 16:25:49
Currently I need to convert json to xml and xml to json vice versa using XSLT 3.0 & Saxon-HE. Below is my json abc.xml file <?xml version="1.0" encoding="UTF-8" ?> <root> <data>{ "cars" : [ {"doors" : "4","price" : "6L"}, {"doors" : "5","price" : "13L"} ] } </data> </root> Below is xsl file xyz.xsl <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:math="http://www.w3.org/2005/xpath-functions/math" exclude-result-prefixes="xs math" version="3.0"> <xsl:output indent="yes"/> <xsl:template match="data"> <xsl:copy-of select="json-to

Syntax error in javax.xml.xpath.XPathFactory provider-configuration file of Saxon-HE 9.3

这一生的挚爱 提交于 2019-11-30 12:38:06
I am using Java SE 6 on Mac OS X and Saxon-HE 9.3.0.5. The ServiceLoader is not able to find the Saxon implementation of javax.xml.xpath.XPathFactory . mac:test2 ludo$ java -version java version "1.6.0_26" Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511) Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode) The javadoc of the newInstance method of javax.xml.xpath.XPathFactory states in point 3 of the lookup procedure to localize an implementation that: The class loader is asked for service provider provider-configuration files matching javax.xml.xpath.XPathFactory

xslt 2.0 tokenize and group

主宰稳场 提交于 2019-11-29 18:17:05
I have an text file with following data: <t>Heros Firstname Sean Lastname Connery DOB 25-08-1930 Films Dr.No 1962 Goldfinger 1964 Thunerball 1965 Award name Academy time 1 Award name BAFTA time 2 Award name Gloden Globes time 3</t> Expected output should look like: <Jamesfilms> <heros> <firstName>Sean</firstName> <lastName>Connery</lastName> <DOB>25-08-1930</DOB> </heros> <films> <Dr.No>1962</Dr.No> <Goldfinger>1964</Goldfinger> <Thunerball>1965</Thunerball> </films> <award> <name>Academy</name> <times>1</times> </award> <award> <name>BAFTA</name> <times>2</times> </award> <award> <name>Gloden

Syntax error in javax.xml.xpath.XPathFactory provider-configuration file of Saxon-HE 9.3

独自空忆成欢 提交于 2019-11-29 17:35:08
问题 I am using Java SE 6 on Mac OS X and Saxon-HE 9.3.0.5. The ServiceLoader is not able to find the Saxon implementation of javax.xml.xpath.XPathFactory . mac:test2 ludo$ java -version java version "1.6.0_26" Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511) Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode) The javadoc of the newInstance method of javax.xml.xpath.XPathFactory states in point 3 of the lookup procedure to localize an implementation that: The class

How to call Java API from Ruby 1.8 or 1.9

不羁的心 提交于 2019-11-29 15:31:48
I've this JRuby working code (stolen from Keith's Blog ), which wraps the SAXON xslt processor API. Now, I wonder whether I can and how can I wrap the same API in Ruby framework? Please tell me if this question is non-sense or if it can be improved in some way. This is the java doc reference for the wanted API . And this is the JRuby code I'm using: require 'java' module JXslt include_class "javax.xml.transform.TransformerFactory" include_class "javax.xml.transform.Transformer" include_class "javax.xml.transform.stream.StreamSource" include_class "javax.xml.transform.stream.StreamResult"

Load xml and xslt from embedded resource in Saxon 9.4he

不问归期 提交于 2019-11-29 10:56:25
I am using Saxon 9.4 home edition ( Saxon-HE 9.4 .NET ) to get support for XSLT 2.0 and XPath 2.0, and XQuery 1.0 in .NET. My code crashes when I load files without an URI. Is it possible to load xml/xsl documents without an URI related to the document loaded? If not, is there any way to define URI for elements embedded in dll-files? Any other solutions will also be appreciated, my only term is that the files must be loaded from within the dll-file. My code works perfectly as long as i load xml/xsl from file: const string sourcePath = @"C:\test\TestInvoiceWithError.xml"; const string xsltpath