Project

Profile

Help

Support #5740

closed

Is there any way to get serialization properties from Serializer with SaxonCS?

Added by Martin Honnen over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
.NET API
Sprint/Milestone:
-
Start date:
2022-11-21
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
11
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
.NET

Description

With the SaxonJ s9api API, I am able to subclass the Serializer class for the main purpose to override the getReceiver method to read out certain serialization properties e.g. the serialization method:

public class MySerializer extends Serializer {

    private String method;

    public String getMethod() {
        return method;
    }

    private Writer myWriter;

    protected MySerializer(Processor processor) {
        super(processor);
    }

    public Writer getWriter() {
        return myWriter;
    }

    @Override
    public void setOutputWriter(Writer writer) {
        myWriter = writer;
        super.setOutputWriter(writer);
    }

    @Override
    public Receiver getReceiver(PipelineConfiguration pipe, SerializationProperties params) throws SaxonApiException {
        method = params.getProperty("method");
        return super.getReceiver(pipe, params);
    }
}

Now I am wondering how to do the same with SaxonCS but it seems I don't find a way, the C# Saxon.Api.Serializer seems to rely on an internal class Saxon.Hej.s9api.Serializer my C# code can't access to subclass it. There doesn't seem to be any other public property or method on Saxon.Api.Serializer to extract e.g. the serialization method property or other serialization properties in general.

Have I overlooked something?

Or is the design on .NET for SaxonCS more restricted than the Java API (and the previous Saxon .NET API where you also could somehow subclass the Java Serializer/override the getReceiver method)?

Actions #1

Updated by Michael Kay over 1 year ago

Correct, the Saxon.Api.Serializer has not been designed with subclassing in mind; it's just a shim over the internal implementation class, and we haven't designed C# interfaces to allow the internal mechanisms to be customised.

It would be easy enough to provide methods giving access to the serialization properties, the only problem being that the actual properties used are a rather complex function of what's specified in the API and what's specified in the actual query or stylesheet.

Actions #2

Updated by Michael Kay about 1 year ago

  • Status changed from New to Closed

I'm afraid I can't see any straightforward way of extending the API to provide this information, so I'm going to close the request with no action.

Please register to edit this issue

Also available in: Atom PDF