using custom parser in saxon 9 transformation scenario

Hi, I'm new to oxygen, but I have written a custom uri resolver which references a custom parser, for saxon 9. The parser reads a binary format file, and returns xml events to saxon. It seems to work well interactively; now I would like to use it in the oxygen xslt debugging environment. I have configured a transformation scenario with the appropriate classes on the class path including both the resolver and the parser and classes upon which they depend. However when I invoke the transformation, I get "Content is not allowed in prolog", which looks to me like the parser isn't getting first crack at the binary data. Does anyone have a suggestion to help with this? Cheers, Peter

Hello, First you should make sure that your custom URI resolver is configured correctly in the Editor perspective before trying it in the Debugger perspective. The custom URI resolver and all the Java classes referenced from the custom URI resolver including the custom XML parser must be set as XSLT extensions for your transformation. You set an XSLT extension in the dialog opened by the Extensions button of the scenario edit dialog: http://www.oxygenxml.com/doc/ug-standalone/xslt-xquery-extensions.html You have to set the full name of the Saxon 9 URI resolver class in the Saxon 9 Advanced settings available from menu Options -> Preferences -> XML -> XSLT/FO/XQuery -> XSLT -> Saxon -> Saxon 9 -> Advanced -- URI Resolver class name. If you type "uri" in the search field of the Preferences dialog you can locate this setting quickly. Does the URI resolver work in a transformation applied with a transformation scenario in the Editor perspective? Regards, Sorin Peter Rushforth wrote:
Hi,
I'm new to oxygen, but I have written a custom uri resolver which references a custom parser, for saxon 9.
The parser reads a binary format file, and returns xml events to saxon. It seems to work well interactively; now I would like to use it in the oxygen xslt debugging environment.
I have configured a transformation scenario with the appropriate classes on the class path including both the resolver and the parser and classes upon which they depend.
However when I invoke the transformation, I get "Content is not allowed in prolog", which looks to me like the parser isn't getting first crack at the binary data.
Does anyone have a suggestion to help with this?
Cheers, Peter

Hi, I believe I've set the extension classes correctly. An odd thing is that when I try to run the same thing from the command line, when I *don't* use the -u option I get the same message regarding content not allowed in prolog. Where I look at the saxon command line documentation, I see that the -u option is used to tell saxon that the files are "urls", unless they begin with http: or file:, in which case they are taken as urls as is. But I don't see anywhere in oxygen I can set the -u parameter. Thanks for your help. Cheers, Peter On Mon, Apr 21, 2008 at 11:34 AM, Sorin Ristache <sorin@oxygenxml.com> wrote:
Hello,
First you should make sure that your custom URI resolver is configured correctly in the Editor perspective before trying it in the Debugger perspective. The custom URI resolver and all the Java classes referenced from the custom URI resolver including the custom XML parser must be set as XSLT extensions for your transformation. You set an XSLT extension in the dialog opened by the Extensions button of the scenario edit dialog:
http://www.oxygenxml.com/doc/ug-standalone/xslt-xquery-extensions.html
You have to set the full name of the Saxon 9 URI resolver class in the Saxon 9 Advanced settings available from menu Options -> Preferences -> XML -> XSLT/FO/XQuery -> XSLT -> Saxon -> Saxon 9 -> Advanced -- URI Resolver class name. If you type "uri" in the search field of the Preferences dialog you can locate this setting quickly.
Does the URI resolver work in a transformation applied with a transformation scenario in the Editor perspective?
Regards, Sorin
Peter Rushforth wrote:
Hi,
I'm new to oxygen, but I have written a custom uri resolver which references a custom parser, for saxon 9.
The parser reads a binary format file, and returns xml events to saxon. It seems to work well interactively; now I would like to use it in the oxygen xslt debugging environment.
I have configured a transformation scenario with the appropriate classes on the class path including both the resolver and the parser and classes upon which they depend.
However when I invoke the transformation, I get "Content is not allowed in prolog", which looks to me like the parser isn't getting first crack at the binary data.
Does anyone have a suggestion to help with this?
Cheers, Peter
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

Hello, Now I think I understand. You want to apply an XSLT stylesheet to a stream of XML events generated by a custom parser from a binary file. You call the custom parser from a custom URI resolver that resolves the URL of the input XML file. You set the -u parameter for passing the URL of the input XML file through the custom URI resolver. This cannot be done in the current version of Oxygen because Oxygen passes the URL of the input XML file only through a built-in resolver that tries to resolve the URL of the input XML file with the XML catalogs set in the user preferences. The Saxon custom URI resolver is used by Saxon internally only for URIs from the XSLT stylesheet because the stream of XML events from the input XML file is provided by Oxygen. A future version of Oxygen will pass the URL of the input file also through the Saxon custom URI resolver as if the -u parameter is always set when Saxon is used in Oxygen. There is a very simple workaround: load the input file through your custom URI resolver directly from the XSLT stylesheet with the document() function, something like: <xsl:template match="/"> <xsl:apply-templates select="document('URI-of-binary-file-resolved-by-custom-UR-resolver')"/> </xsl:template> Of course you have to set the class name of your custom URI resolver in Options -> Preferences -- XML -- XSLT/FO/XQuery -- XSLT -- Saxon -- Saxon 9 -- Advanced -- URI Resolver class name. Regards, Sorin Peter Rushforth wrote:
I believe I've set the extension classes correctly. An odd thing is that when I try to run the same thing from the command line, when I *don't* use the -u option I get the same message regarding content not allowed in prolog.
Where I look at the saxon command line documentation, I see that the -u option is used to tell saxon that the files are "urls", unless they begin with http: or file:, in which case they are taken as urls as is.
But I don't see anywhere in oxygen I can set the -u parameter.

Hi Sorin,
Now I think I understand. You want to apply an XSLT stylesheet to a stream of XML events generated by a custom parser from a binary file. You call the custom parser from a custom URI resolver that resolves the URL of the input XML file. You set the -u parameter for passing the URL of the input XML file through the custom URI resolver.
That's right.
This cannot be done in the current version of Oxygen because Oxygen passes the URL of the input XML file only through a built-in resolver that tries to resolve the URL of the input XML file with the XML catalogs set in the user preferences. The Saxon custom URI resolver is used by Saxon internally only for URIs from the XSLT stylesheet because the stream of XML events from the input XML file is provided by Oxygen. A future version of Oxygen will pass the URL of the input file also through the Saxon custom URI resolver as if the -u parameter is always set when Saxon is used in Oxygen.
I look forward to that.
There is a very simple workaround: load the input file through your custom URI resolver directly from the XSLT stylesheet with the document() function, something like:
<xsl:template match="/"> <xsl:apply-templates select="document('URI-of-binary-file-resolved-by-custom-UR-resolver')"/> </xsl:template>
Of course you have to set the class name of your custom URI resolver in Options -> Preferences -- XML -- XSLT/FO/XQuery -- XSLT -- Saxon -- Saxon 9 -- Advanced -- URI Resolver class name.
Did that. I tried this but it didn't work either. Still got the "Content not allowed in prolog" message. Thanks Peter

Can you send the XSLT stylesheet, a jar file with the custom parser, a jar file with the custom URI resolver and the expected result of the transformation? Regards, Sorin Peter Rushforth wrote:
Did that.
I tried this but it didn't work either. Still got the "Content not allowed in prolog" message.

Oh and no a regular transformation scenario doesn't work. I was trying to set that up with a simple identity transformation on a simple binary file before getting fancy. Thx On Mon, Apr 21, 2008 at 11:34 AM, Sorin Ristache <sorin@oxygenxml.com> wrote:
Hello,
First you should make sure that your custom URI resolver is configured correctly in the Editor perspective before trying it in the Debugger perspective. The custom URI resolver and all the Java classes referenced from the custom URI resolver including the custom XML parser must be set as XSLT extensions for your transformation. You set an XSLT extension in the dialog opened by the Extensions button of the scenario edit dialog:
http://www.oxygenxml.com/doc/ug-standalone/xslt-xquery-extensions.html
You have to set the full name of the Saxon 9 URI resolver class in the Saxon 9 Advanced settings available from menu Options -> Preferences -> XML -> XSLT/FO/XQuery -> XSLT -> Saxon -> Saxon 9 -> Advanced -- URI Resolver class name. If you type "uri" in the search field of the Preferences dialog you can locate this setting quickly.
Does the URI resolver work in a transformation applied with a transformation scenario in the Editor perspective?
Regards, Sorin
Peter Rushforth wrote:
Hi,
I'm new to oxygen, but I have written a custom uri resolver which references a custom parser, for saxon 9.
The parser reads a binary format file, and returns xml events to saxon. It seems to work well interactively; now I would like to use it in the oxygen xslt debugging environment.
I have configured a transformation scenario with the appropriate classes on the class path including both the resolver and the parser and classes upon which they depend.
However when I invoke the transformation, I get "Content is not allowed in prolog", which looks to me like the parser isn't getting first crack at the binary data.
Does anyone have a suggestion to help with this?
Cheers, Peter
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user
participants (2)
-
Peter Rushforth
-
Sorin Ristache