Skip navigation links

Package nl.knaw.dans.rs.aggregator.xml

JAXB implementation for marshalling and unmarshalling sitemap documents.

See: Description

Package nl.knaw.dans.rs.aggregator.xml Description

JAXB implementation for marshalling and unmarshalling sitemap documents.

The class RsBuilder can be used to marshal and unmarshal ResourceSync sitemap documents to and from a class hierarchy.

   RsBuilder rsBuilder = new RsBuilder(new ResourceSyncContext());
   Optional<RsRoot> maybeRoot = rsBuilder.setInputStream(inStream).build();
 

RsRoot is the superclass of two classes that represent the two possible root elements of a sitemap: <sitemapindex> and <urlset>: the classes Sitemapindex and Urlset.

RsBuilder can also be used to marshal a class hierarchy to its xml-representation. Continuing from the previous example (and knowing the unmarshalled thing was a Urlset):

   Urlset urlSet = rsBuilder.getUrlset().orElseThrow(RuntimeException::new);
   String xml = rsBuilder.toXml(urlSet, true);
 
Skip navigation links

Copyright © 2017. All rights reserved.