Building a tiny tree from String (or DOMResult)

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

Building a tiny tree from String (or DOMResult)

Patrik.Stellmann
Hi,

I'm trying to implement an extension instruction that internally performs another xsl transformation and returns the result as an xml node.

Since the configuration of the two transformers might be incompatible I'm planning to convert the result first to a string and create a TinyTree from that. But so far I failed to do so. Could you please give me a hint how to create a TinyTree from either a String or a DOMResult?

Thanks and regards,

Patrik

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 distributionof 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: Building a tiny tree from String (or DOMResult)

Michael Kay
Assuming you have the target Configuration to hand, it’s

config.buildDocument(new StreamSource(new StringReader(string)))

This will use the default tree model for the Configuration, which is normally a TinyTree. If you want to force this tree model, or if you want more control generally over the parsing operation, you can supply a second argument to buildDocument() which is a ParserOptions object, on which you can set for example

parserOptions.setModel(TreeModel.TINY_TREE);

Michael Kay
Saxonica


On 12 Oct 2015, at 15:12, [hidden email] wrote:

Hi,

I'm trying to implement an extension instruction that internally performs another xsl transformation and returns the result as an xml node.

Since the configuration of the two transformers might be incompatible I'm planning to convert the result first to a string and create a TinyTree from that. But so far I failed to do so. Could you please give me a hint how to create a TinyTree from either a String or a DOMResult?

Thanks and regards,

Patrik

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 distributionof 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


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

_______________________________________________
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: Building a tiny tree from String (or DOMResult)

Michael Kay
Sorry, it’s ParseOptions not ParserOptions.

MK

On 12 Oct 2015, at 17:44, Michael Kay <[hidden email]> wrote:

Assuming you have the target Configuration to hand, it’s

config.buildDocument(new StreamSource(new StringReader(string)))

This will use the default tree model for the Configuration, which is normally a TinyTree. If you want to force this tree model, or if you want more control generally over the parsing operation, you can supply a second argument to buildDocument() which is a ParserOptions object, on which you can set for example

parserOptions.setModel(TreeModel.TINY_TREE);

Michael Kay
Saxonica


On 12 Oct 2015, at 15:12, [hidden email] wrote:

Hi,

I'm trying to implement an extension instruction that internally performs another xsl transformation and returns the result as an xml node.

Since the configuration of the two transformers might be incompatible I'm planning to convert the result first to a string and create a TinyTree from that. But so far I failed to do so. Could you please give me a hint how to create a TinyTree from either a String or a DOMResult?

Thanks and regards,

Patrik

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 distributionof 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

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


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

_______________________________________________
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: Building a tiny tree from String (or DOMResult)

Patrik.Stellmann
Hi Michael,

thanks alot, that's working fine. (I'm using XPathContext.getConfiguration)

Patrik




Von:        Michael Kay <[hidden email]>
An:        Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>,
Datum:        12.10.2015 18:50
Betreff:        Re: [saxon] Building a tiny tree from String (or DOMResult)




Sorry, it’s ParseOptions not ParserOptions.

MK

On 12 Oct 2015, at 17:44, Michael Kay <mike@...> wrote:

Assuming you have the target Configuration to hand, it’s

config.buildDocument(new StreamSource(new StringReader(string)))

This will use the default tree model for the Configuration, which is normally a TinyTree. If you want to force this tree model, or if you want more control generally over the parsing operation, you can supply a second argument to buildDocument() which is a ParserOptions object, on which you can set for example

parserOptions.setModel(TreeModel.TINY_TREE);

Michael Kay
Saxonica


On 12 Oct 2015, at 15:12, [hidden email] wrote:

Hi,

I'm trying to implement an extension instruction that internally performs another xsl transformation and returns the result as an xml node.


Since the configuration of the two transformers might be incompatible I'm planning to convert the result first to a string and create a TinyTree from that. But so far I failed to do so. Could you please give me a hint how to create a TinyTree from either a String or a DOMResult?


Thanks and regards,


Patrik



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 distributionof 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