Support #5740
closedIs there any way to get serialization properties from Serializer with SaxonCS?
0%
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)?
Updated by Michael Kay about 2 years 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.
Updated by Michael Kay almost 2 years 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