Package io.goobi.viewer.model.export
Class SolrDocXmlExport
java.lang.Object
io.goobi.viewer.model.export.SolrDocXmlExport
Serialises a
SolrDocumentList into Solr-style XML that can be
consumed directly or fed into an XSLT transformation pipeline.
The output follows the well-known Solr response XML schema:
<result name="response" numFound="N" start="0">
<doc>
<str name="field">value</str>
<arr name="multiField"><str>v1</str><str>v2</str></arr>
</doc>
</result>
-
Method Summary
Modifier and TypeMethodDescriptionstatic DocumenttoXmlDocument(org.apache.solr.common.SolrDocumentList docs) Converts the given Solr document list to a DOMDocument.static StringtoXmlString(org.apache.solr.common.SolrDocumentList docs) Converts the given Solr document list to an XML string.
-
Method Details
-
toXmlString
public static String toXmlString(org.apache.solr.common.SolrDocumentList docs) throws ParserConfigurationException, TransformerException Converts the given Solr document list to an XML string.- Parameters:
docs- the Solr documents to serialise; must not be null- Returns:
- XML string in Solr response format
- Throws:
ParserConfigurationException- if the XML document builder cannot be createdTransformerException- if the DOM-to-string transformation fails
-
toXmlDocument
public static Document toXmlDocument(org.apache.solr.common.SolrDocumentList docs) throws ParserConfigurationException Converts the given Solr document list to a DOMDocument.- Parameters:
docs- the Solr documents to serialise; must not be null- Returns:
- DOM document in Solr response format
- Throws:
ParserConfigurationException- if the XML document builder cannot be created
-