Closed mulveyr closed 1 month ago
First, <DateFormat>
is deprecated in onix 3.0, and completely removed in onix 3.1.
So I guess you're using the -onix308
maven version.
Note that <DateFormat>
is a member of <PublishingDate>
, not an attribute.
So looking at your example, you'll need to use publishingDate.dateFormat()
rather than publishingDate.date().dateformat
.
product.publishingDetail().publishingDates().find(PublishingDateRoles.Publication_date).ifPresent(pd -> {
pd.date();
pd.dateFormat(); // different from pd.date().dateformat;
});
The proper way to indicate the date format (which is the only way supported as of onix 3.1) is to use the dateformat
attribute of the Date
element (which is what you did in your code). But then your source has to look as follow:
In the latest ONIX standard, PublishingDate/DateFormat is still a valid, though deprecated element. So, for example,
should be allowed. However, attempting to access it via, for example:
publishingDate = product.publishingDetail().publishingDates().filter(pd -> pd.publishingDateRole().descriptionOrNull().equals(PublishingDateRoles.Publication_date.getDescription())).firstOrEmpty().date().value;
and then
String format = publishingDate.date().dateformat;
returns a null for format.
Is there any way of accessing the deprecated element? Especially since we have a feed in which a client is sending this way, instead of having the dateformat attribute in the Date element itself.