Runtime Errors from parse-xml not catched
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 87
- Joined: Tue Jan 01, 2013 3:19 pm
Runtime Errors from parse-xml not catched
Hi,
i have to parse strings with escaped markup, contained in the @body attribute of an ownedComment Element. An example woud be @body='<p>test</p>'
In order to deal with parser errors, which could be caused by typos in the string above, i'd like to use the new try/catch mechanism of XSLT 3.
So i wrote something along these lines:
Everything works fine as long as the input can be parsed without errors. But if it is not well-formed, or if it contains references to undeclared entities, the runtime error is not catched. I would like to get the DocBook para Element with error as content, but instead the transformation fails with an error message from saxon which tells me, why the string cannot be parsed.
This is a bug, isn't it?
Oxygen 17.0, build 2015051321 on Windows 7 64 bit with Saxon EE 9.6.0.5. Stylesheet Version is 3.0.
Sincerely,
Frank
i have to parse strings with escaped markup, contained in the @body attribute of an ownedComment Element. An example woud be @body='<p>test</p>'
In order to deal with parser errors, which could be caused by typos in the string above, i'd like to use the new try/catch mechanism of XSLT 3.
So i wrote something along these lines:
Code: Select all
<xsl:try>
<xsl:variable name="doc" as="document-node()" select="parse-xml-fragment(db:escapeEntities($string))"/>
<xsl:apply-templates select="$doc/*" mode="db-ns"/>
<xsl:catch>
<db:para>ERROR</db:para>
</xsl:catch>
</xsl:try>
This is a bug, isn't it?
Oxygen 17.0, build 2015051321 on Windows 7 64 bit with Saxon EE 9.6.0.5. Stylesheet Version is 3.0.
Sincerely,
Frank
-
- Posts: 404
- Joined: Thu Aug 21, 2003 11:36 am
- Location: Craiova
- Contact:
Re: Runtime Errors from parse-xml not catched
Post by radu_pisoi »
Hi,
I have tried to reproduce the problem by running the transformation with Saxon EE 9.6.0.5 from the command line. In this case, the transformation behavior is the expected one. If the document to be parsed is not wellformed then the result of the try instruction is given by the evaluation of the catch clause.
So, this seems to be an oXygen specific issue that comes from the interaction between oXygen and the Saxon processor.
I will register it to our issue tracking system to be resolved in a future oXygen version.
I have tried to reproduce the problem by running the transformation with Saxon EE 9.6.0.5 from the command line. In this case, the transformation behavior is the expected one. If the document to be parsed is not wellformed then the result of the try instruction is given by the evaluation of the catch clause.
So, this seems to be an oXygen specific issue that comes from the interaction between oXygen and the Saxon processor.
I will register it to our issue tracking system to be resolved in a future oXygen version.
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 125
- Joined: Mon Jun 09, 2003 6:02 pm
- Location: Charlottesville, Virginia USA
Re: Runtime Errors from parse-xml not catched
There is a similar problem with XQuery and fn:parse-xml():
If you run that with standalone Saxon 9.6.0.7, the output is
I hope that behavior can be fixed -- I also need to use fn:parse-xml() with try/catch in order to find bad quoted HTML that looks like my variable above.
Code: Select all
xquery version "3.0";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:omit-xml-declaration "true";
try {
let $xml-string := '<para>Paragraph</p>'
return parse-xml($xml-string)
}
catch * {
<error>{$err:code}</error>
}
and a message is sent to standard error<error>err:FODC0006</error>
If I run the code in oXygen, I get only the "Transformation problems" message reporting "Error reported by XML parser", but there is no output from the transformation.SXXP0003: Error reported by XML parser: The element type "para" must be terminated by the
matching end-tag "</para>".
I hope that behavior can be fixed -- I also need to use fn:parse-xml() with try/catch in order to find bad quoted HTML that looks like my variable above.
-
- Posts: 404
- Joined: Thu Aug 21, 2003 11:36 am
- Location: Craiova
- Contact:
Re: Runtime Errors from parse-xml not catched
Post by radu_pisoi »
Hi,
Yes, it seems to be a similar problem. The transformation execution should not be stopped when an dynamic error is caught by try/catch instruction.
I will also register this case in our issue tracking system.
Yes, it seems to be a similar problem. The transformation execution should not be stopped when an dynamic error is caught by try/catch instruction.
I will also register this case in our issue tracking system.
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 9450
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Runtime Errors from parse-xml not catched
Hi,
Just to update this thread, the issue should be fixed in Oxygen 18.1 which we released a couple of weeks ago.
Regards,
Radu
Just to update this thread, the issue should be fixed in Oxygen 18.1 which we released a couple of weeks ago.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service