alisummer2000000
alisummer2000000

Reputation: 23

Serializer() method "constructor serializer() is not defined" in Java Eclipse

I have a problem in a class created for xslt transformation using SAXON. The serializer is imported and from this class a serializer is built.

Serializer serializer = new Serializer();

I receive the error message " the constructor serializer() is not defined".

when I CTRL+click on it, it says "source not found".

Note: the jar package of the Saxon HE library is added.

error message

Upvotes: 1

Views: 163

Answers (1)

Michael Kay
Michael Kay

Reputation: 163498

There was an API change between releases. In 9.5 the Serializer class had a public zero-argument constructor. This was deprecated in 9.6 and 9.7, and removed in Saxon 9.8.

The preferred alternative is to use the factory method:

processor.newSerializer()

The reason for the change was to ensure that the Serializer always has access to configuration information in the Configuration object.

It also allows us potential to introduce subclasses of Serializer in future releases, should we choose to do so.

Upvotes: 2

Related Questions