Subject: Re: [xsl] Getting info of runtime failure in saxon environment From: Wendell Piez <wapiez@xxxxxxxxxxxxxxx> Date: Thu, 21 Feb 2013 10:12:19 -0500 |
Hi Karl, There are many ways to parse XML files, checking them for well-formedness and detecting this kind of error; yours isn't really an XSLT problem. If Xerces doesn't report a location to Saxon, then Saxon can't report it to you. The solution is to parse your files with another utility before running them, to determine which ones are (not) actually XML. Saxon's interface to the collection() function offers an "on-error=ignore" option, which should mitigate your problem running the XSLT. But it won't locate the broken file. I hope this helps, Wendell On Thu, Feb 21, 2013 at 4:25 AM, Karlmarx R <karlmarxr@xxxxxxxxx> wrote: > Hello List, > > I running my xsl-xml conversion using Saxon processor in java, called from command line using a batch file that contains "java -jar saxon9.jar ...". The source XML comes with some invalid byte char that results in error. > > Error at xsl:for-each on line 61 of xxx.xsl: > com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 > of 1-byte UTF-8 sequence. > Transformation failed: Run-time errors were reported > > The above error showing xsl line number is of not much use, but for information purpose, the for-each statement trries to process files of a collection. Exampple code: > <xsl:variable name="inputFiles" select="collection(concat($dirInput,'?select=*.xml;recurse=yes'))"/> > <xsl:for-each select="$inputFiles"> > > What I need is some information giving clue which line of XML data results in this error, like say "in xml...line number n char x fails.." sort of message that will make it easy to identify xml error without the need of using specialised tools. Is this possible? I am still reading the documents in saxonica and read "An error reported by the XML parser is generally fatal. It is not possible to process ill-formed XML." statement but any possible solution would be of great help. FYI, I did identified and corrected the source xml using specialised xml tools, but going forward we need to use command line option which could be used by someone with basic xml knowledge. > > Thanks in adv, > Karl > -- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Getting info of runtime fail, Karlmarx R | Thread | [xsl] Normalizing Whitespace When N, Nathan Tallman |
[xsl] Getting info of runtime fail, Karlmarx R | Date | [xsl] Normalizing Whitespace When N, Nathan Tallman |
Month |