Saxon implementation of result interface

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Saxon implementation of result interface

Julia.Nissen
Hi,

from java we are performing a saxon xslt transformation with code like this:
{
        [...]
        transformer = transformerFactory.newTransformer(xslSource);
        DOMResult result = new DOMResult();
        transformer.transform(xmlSource, result);
        return result.getNode();
}

Now we would like the method to return an instance of net.sf.saxon.om.NodeInfo instead of org.w3c.dom.Node.
Is there any saxon class that implements the Result interface and creates a node tree using NodeInfo internally?

Thanks and regards,

Julia

GDV Dienstleistungs-GmbH & Co. KG
Glockengießerwall 1
D-20095 Hamburg
www.gdv-dl.de

Sitz und Registergericht: Hamburg
HRA 93 894
USt.-IdNr : DE 205183123

Komplementärin:
GDV Beteiligungsgesellschaft mbH
Sitz und Registergericht: Hamburg
HRB 71 153

Geschäftsführer:
Dr. Jens Bartenwerfer
Michael Bathke
Volker Sonnenburg

------------------------------------------------------------------
Diese E-Mail und alle Anhänge enthalten vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe der E-Mail ist nicht gestattet.

This e-mail and any attached files may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Saxon implementation of result interface

Martin Honnen-2
[hidden email] wrote:

> from java we are performing a saxon xslt transformation with code like
> this:
> {
>          [...]
>          transformer = transformerFactory.newTransformer(xslSource);
>          DOMResult result = new DOMResult();
>          transformer.transform(xmlSource, result);
>          return result.getNode();
> }
>
> Now we would like the method to return an instance of
> net.sf.saxon.om.NodeInfo instead of org.w3c.dom.Node.
> Is there any saxon class that implements the Result interface and
> creates a node tree using NodeInfo internally?

There is
http://saxonica.com/html/documentation/javadoc/net/sf/saxon/tree/tiny/TinyBuilder.html 
for instance but I don't know whether you are not better of using the
s9api API instead of JAXP if you want to use Saxon's classes.



------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Antwort: Re: Saxon implementation of result interface

Julia.Nissen
That works fine, thanks a lot!.

Regards,
Julia



Von:        Martin Honnen <[hidden email]>
An:        Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>,
Datum:        09.11.2015 14:59
Betreff:        Re: [saxon] Saxon implementation of result interface




[hidden email] wrote:

> from java we are performing a saxon xslt transformation with code like
> this:
> {
>          [...]
>          transformer = transformerFactory.newTransformer(xslSource);
>          DOMResult result = new DOMResult();
>          transformer.transform(xmlSource, result);
>          return result.getNode();
> }
>
> Now we would like the method to return an instance of
> net.sf.saxon.om.NodeInfo instead of org.w3c.dom.Node.
> Is there any saxon class that implements the Result interface and
> creates a node tree using NodeInfo internally?

There is
http://saxonica.com/html/documentation/javadoc/net/sf/saxon/tree/tiny/TinyBuilder.html
for instance but I don't know whether you are not better of using the
s9api API instead of JAXP if you want to use Saxon's classes.



------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
saxon-help mailing list archived at
http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help

GDV Dienstleistungs-GmbH & Co. KG
Glockengießerwall 1
D-20095 Hamburg
www.gdv-dl.de

Sitz und Registergericht: Hamburg
HRA 93 894
USt.-IdNr : DE 205183123

Komplementärin:
GDV Beteiligungsgesellschaft mbH
Sitz und Registergericht: Hamburg
HRB 71 153

Geschäftsführer:
Dr. Jens Bartenwerfer
Michael Bathke
Volker Sonnenburg

------------------------------------------------------------------
Diese E-Mail und alle Anhänge enthalten vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe der E-Mail ist nicht gestattet.

This e-mail and any attached files may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Saxon implementation of result interface

Michael Kay
In reply to this post by Martin Honnen-2
I would be inclined to recommend using the XdmDestination class in s9api.

XdmDestination in 9.6 in fact supplies a TinyBuilder, protected by a TreeProtector:

<code>
TreeModel model = treeModel;
if (model == null) {
    model = TreeModel.getTreeModel(config.getTreeModel());
}
PipelineConfiguration pipe = config.makePipelineConfiguration();
builder = model.makeBuilder(pipe);
if (baseURI != null) {
    builder.setBaseURI(baseURI.toString());
}
return new TreeProtector(builder);
</code>

where the role of the TreeProtector is to validate the events being passed to the Builder to ensure they constitute a well-formed XML document.

But in 9.7 it gets more complicated because the output is no longer always an XML tree; it can be for example a map to be serialized as JSON. The XdmDestination approach in s9api will handle that, the JAXP interface won't.

Michael Kay
Saxonica



> On 9 Nov 2015, at 13:56, Martin Honnen <[hidden email]> wrote:
>
> [hidden email] wrote:
>
>> from java we are performing a saxon xslt transformation with code like
>> this:
>> {
>>         [...]
>>         transformer = transformerFactory.newTransformer(xslSource);
>>         DOMResult result = new DOMResult();
>>         transformer.transform(xmlSource, result);
>>         return result.getNode();
>> }
>>
>> Now we would like the method to return an instance of
>> net.sf.saxon.om.NodeInfo instead of org.w3c.dom.Node.
>> Is there any saxon class that implements the Result interface and
>> creates a node tree using NodeInfo internally?
>
> There is
> http://saxonica.com/html/documentation/javadoc/net/sf/saxon/tree/tiny/TinyBuilder.html 
> for instance but I don't know whether you are not better of using the
> s9api API instead of JAXP if you want to use Saxon's classes.
>
>
>
> ------------------------------------------------------------------------------
> Presto, an open source distributed SQL query engine for big data, initially
> developed by Facebook, enables you to easily query your data on Hadoop in a
> more interactive manner. Teradata is also now providing full enterprise
> support for Presto. Download a free open source copy now.
> http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help 



------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Saxon implementation of result interface

Julia.Nissen
In reply to this post by Julia.Nissen
Hello,
 
Following your recommendation, I used the XdmDestination class and it works. Thanks a lot!
 
Regards,
Julia Nissen
 
 
 
Von:    Michael Kay <[hidden email]>
An:     Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>,
Datum:  09.11.2015 15:52
Betreff:        Re: [saxon] Saxon implementation of result interface
 
 
I would be inclined to recommend using the XdmDestination class in s9api.

XdmDestination in 9.6 in fact supplies a TinyBuilder, protected by a TreeProtector:

<code>
TreeModel model = treeModel;
if (model == null) {
    model = TreeModel.getTreeModel(config.getTreeModel());
}
PipelineConfiguration pipe = config.makePipelineConfiguration();
builder = model.makeBuilder(pipe);
if (baseURI != null) {
    builder.setBaseURI(baseURI.toString());
}
return new TreeProtector(builder);
</code>

where the role of the TreeProtector is to validate the events being passed to the Builder to ensure they constitute a well-formed XML document.

But in 9.7 it gets more complicated because the output is no longer always an XML tree; it can be for example a map to be serialized as JSON. The XdmDestination approach in s9api will handle that, the JAXP interface won't.

Michael Kay
Saxonica



> On 9 Nov 2015, at 13:56, Martin Honnen <[hidden email]> wrote:
>
> [hidden email] wrote:
>
>> from java we are performing a saxon xslt transformation with code like
>> this:
>> {
>>         [...]
>>         transformer = transformerFactory.newTransformer(xslSource);
>>         DOMResult result = new DOMResult();
>>         transformer.transform(xmlSource, result);
>>         return result.getNode();
>> }
>>
>> Now we would like the method to return an instance of
>> net.sf.saxon.om.NodeInfo instead of org.w3c.dom.Node.
>> Is there any saxon class that implements the Result interface and
>> creates a node tree using NodeInfo internally?
>
> There is
> http://saxonica.com/html/documentation/javadoc/net/sf/saxon/tree/tiny/TinyBuilder.html
> for instance but I don't know whether you are not better of using the
> s9api API instead of JAXP if you want to use Saxon's classes.
>
>
>
> ------------------------------------------------------------------------------
> Presto, an open source distributed SQL query engine for big data, initially
> developed by Facebook, enables you to easily query your data on Hadoop in a
> more interactive manner. Teradata is also now providing full enterprise
> support for Presto. Download a free open source copy now.
> http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help



------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
------------------------------------------------------------------
System-Architektur und IT-Projekte
Tel:
Fax:
E-Mail: [hidden email]

GDV Dienstleistungs-GmbH & Co. KG
Glockengießerwall 1
D-20095 Hamburg
www.gdv-dl.de

Sitz und Registergericht: Hamburg
HRA 93 894
USt.-IdNr : DE 205183123

Komplementärin:
GDV Beteiligungsgesellschaft mbH
Sitz und Registergericht: Hamburg
HRB 71 153

Geschäftsführer:
Dr. Jens Bartenwerfer
Michael Bathke
Volker Sonnenburg

------------------------------------------------------------------
Diese E-Mail und alle Anhänge enthalten vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe der E-Mail ist nicht gestattet.

This e-mail and any attached files may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Saxon implementation of result interface

Julia.Nissen
In reply to this post by Julia.Nissen

Hello,

 

using the s9api another question came up:

 

In the xsl script to be executed we have parameters like this:

      <xsl:param name="minCount"     as="xs:integer" select="1"/>
     
<xsl:param name="sectionTitle" as="xs:string?"/>

 

Using the JAXP API we’ve set these parameters from java with this code:

transformer.setParameter(paramName, paramValue);

where paramName and paramValue are both of type String. And it was working fine.

 

Now using s9api we changed this to:

xsltTransformer.setParameter(new QName(paramName), new XdmAtomicValue(paramValue))

 

Now when the script is executed we get an error:

„Required item type of value of variable $minCount is xs:integer; supplied value has item type xs:string“

 

Is there any class we can use as parameter value that can be casted dynamically to xs:string as well as xs:integer (and float, boolean, …)?

 

Thanks and Regards,

 

Julia

 

 

System-Architektur und IT-Projekte

Fon:

Fax:

Mail:

[hidden email]

GDV-DL-Logo GDV Dienstleistungs-GmbH & Co. KG
Glockengießerwall 1
20095 Hamburg
Web:
gdv-dl.de


Sitz & Registergericht:
Hamburg
HRA 93 894
USt.-IdNr: DE 205183123

Geschäftsführer: Dr. Jens Bartenwerfer
Michael Bathke

Volker Sonnenburg






Diese E-Mail und alle Anhänge enthalten vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe der E-Mail ist nicht gestattet.

This e-mail and any attached files may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Von: Julia Nissen [mailto:[hidden email]]
Gesendet: Mittwoch, 11. November 2015 08:00
An: Mailing list for the SAXON XSLT and XQuery processor
Betreff: Re: [saxon] Saxon implementation of result interface

 

Hello,

 

Following your recommendation, I used the XdmDestination class and it works. Thanks a lot!

 

Regards,

Julia Nissen

 

 

 

Von:    Michael Kay <[hidden email]>

An:     Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>,

Datum:  09.11.2015 15:52

Betreff:        Re: [saxon] Saxon implementation of result interface

 

 

I would be inclined to recommend using the XdmDestination class in s9api.

XdmDestination in 9.6 in fact supplies a TinyBuilder, protected by a TreeProtector:

<code>
TreeModel model = treeModel;
if (model == null) {
    model = TreeModel.getTreeModel(config.getTreeModel());
}
PipelineConfiguration pipe = config.makePipelineConfiguration();
builder = model.makeBuilder(pipe);
if (baseURI != null) {
    builder.setBaseURI(baseURI.toString());
}
return new TreeProtector(builder);
</code>

where the role of the TreeProtector is to validate the events being passed to the Builder to ensure they constitute a well-formed XML document.

But in 9.7 it gets more complicated because the output is no longer always an XML tree; it can be for example a map to be serialized as JSON. The XdmDestination approach in s9api will handle that, the JAXP interface won't.

Michael Kay
Saxonica



> On 9 Nov 2015, at 13:56, Martin Honnen <[hidden email]> wrote:
>
> [hidden email] wrote:
>
>> from java we are performing a saxon xslt transformation with code like
>> this:
>> {
>>         [...]
>>         transformer = transformerFactory.newTransformer(xslSource);
>>         DOMResult result = new DOMResult();
>>         transformer.transform(xmlSource, result);
>>         return result.getNode();
>> }
>>
>> Now we would like the method to return an instance of
>> net.sf.saxon.om.NodeInfo instead of org.w3c.dom.Node.
>> Is there any saxon class that implements the Result interface and
>> creates a node tree using NodeInfo internally?
>
> There is
> http://saxonica.com/html/documentation/javadoc/net/sf/saxon/tree/tiny/TinyBuilder.html
> for instance but I don't know whether you are not better of using the
> s9api API instead of JAXP if you want to use Saxon's classes.
>
>
>
> ------------------------------------------------------------------------------
> Presto, an open source distributed SQL query engine for big data, initially
> developed by Facebook, enables you to easily query your data on Hadoop in a
> more interactive manner. Teradata is also now providing full enterprise
> support for Presto. Download a free open source copy now.
> http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help



------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help

------------------------------------------------------------------
System-Architektur und IT-Projekte
Tel:
Fax:
E-Mail:
[hidden email]

GDV Dienstleistungs-GmbH & Co. KG
Glockengießerwall 1
D-20095 Hamburg
www.gdv-dl.de

Sitz und Registergericht: Hamburg
HRA 93 894
USt.-IdNr : DE 205183123

Komplementärin:
GDV Beteiligungsgesellschaft mbH
Sitz und Registergericht: Hamburg
HRB 71 153

Geschäftsführer:
Dr. Jens Bartenwerfer
Michael Bathke
Volker Sonnenburg

------------------------------------------------------------------
Diese E-Mail und alle Anhänge enthalten vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe der E-Mail ist nicht gestattet.

This e-mail and any attached files may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Saxon implementation of result interface

Michael Kay

On 11 Nov 2015, at 08:03, Julia Nissen <[hidden email]> wrote:

Sorry for the noise - this old message was caught in a moderation queue which has just emerged from my spam filter.

Michael Kay
Saxonica

------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help