in src/main/java/org/apache/sling/sitemap/impl/builder/SitemapIndexImpl.java [69:86]
public void addSitemap(@NotNull String location, @Nullable Instant lastModified) throws SitemapException {
try {
ensureNotClosed();
out.writeStartElement("sitemap");
out.writeStartElement("loc");
out.writeCharacters(location);
out.writeEndElement();
if (lastModified != null) {
out.writeStartElement("lastmod");
out.writeCharacters(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastModified.atOffset(ZoneOffset.UTC)));
out.writeEndElement();
}
out.writeEndElement();
out.flush();
} catch (XMLStreamException ex) {
throw new SitemapException("Failed to add sitemap to index", ex);
}
}