Destination that is a XML Canonicalizer ?

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

Destination that is a XML Canonicalizer ?

cmarchand
I have to save XML transform results in a canonicalized form.
Does such a Serializer exists ?
Does someone have ever try to connect a canonicalizer to a Saxon
Destination ?

Best regards,
Christophe

------------------------------------------------------------------------------
_______________________________________________
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: Destination that is a XML Canonicalizer ?

Michael Kay
I'm aware of two implementations of Canonicalizer - can't speak for either of them. As far as I can see:

The Apache one takes input from either lexical XML as a byte array, or a DOM

The nu.xom one takes input from a XOM tree.

Unfortunately neither seems to accept input as a SAX stream, which is a shame.

It should be possible to plug things together, though it may involve a bit of grovelling. For example if you go the XOM route, you can do

XOMWriter writer = new XOMWriter(processor.getUnderlyingConfiguration().makePipelineConfiguration());
Destination XOMDestination = new Destination() {
   public Receiver getReceiver() {
     return writer;
   }
  public void close(){
    writer.close();
  };
}

then transform to the XOMDestination, then canonicalize the XOM document as

new Canonicalizer(outputStream).write(writer.getDocument());

Michael Kay
Saxonica



> On 7 Sep 2016, at 09:54, [hidden email] wrote:
>
> I have to save XML transform results in a canonicalized form.
> Does such a Serializer exists ?
> Does someone have ever try to connect a canonicalizer to a Saxon
> Destination ?
>
> Best regards,
> Christophe
>
> ------------------------------------------------------------------------------
> _______________________________________________
> 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: Destination that is a XML Canonicalizer ?

cmarchand
Nice trick !
And I love XOM and its simplicity, so let's try this way !

Thanks a lot,
Christophe

Le 2016-09-07 12:59, Michael Kay a écrit :

> I'm aware of two implementations of Canonicalizer - can't speak for
> either of them. As far as I can see:
>
> The Apache one takes input from either lexical XML as a byte array, or
> a DOM
>
> The nu.xom one takes input from a XOM tree.
>
> Unfortunately neither seems to accept input as a SAX stream, which is a
> shame.
>
> It should be possible to plug things together, though it may involve a
> bit of grovelling. For example if you go the XOM route, you can do
>
> XOMWriter writer = new
> XOMWriter(processor.getUnderlyingConfiguration().makePipelineConfiguration());
> Destination XOMDestination = new Destination() {
>    public Receiver getReceiver() {
>      return writer;
>    }
>   public void close(){
>     writer.close();
>   };
> }
>
> then transform to the XOMDestination, then canonicalize the XOM
> document as
>
> new Canonicalizer(outputStream).write(writer.getDocument());
>
> Michael Kay
> Saxonica
>
>
>
>> On 7 Sep 2016, at 09:54, [hidden email] wrote:
>>
>> I have to save XML transform results in a canonicalized form.
>> Does such a Serializer exists ?
>> Does someone have ever try to connect a canonicalizer to a Saxon
>> Destination ?
>>
>> Best regards,
>> Christophe
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> 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