Class XMLResponseParser
java.lang.Object
org.apache.solr.client.solrj.response.ResponseParser
org.apache.solr.client.solrj.response.XMLResponseParser
- Since:
- solr 1.3
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringconsumeRawContent(XMLStreamReader parser) This is a stub method for handling/validating "raw" xml field values in the context of tests.protected static StringconvertRawContent(String raw, Function<XMLStreamReader, String> consumeRawContent) Convenience method that converts raw String input (should be valid xml when wrapped in a root element) and converts it to a format compatible with howXMLResponseParserparses from raw xml fields.A well-behaved ResponseParser will return the content-types it supports.The writer type placed onto the request as thewtparam.processResponse(InputStream in, String encoding) readArray(XMLStreamReader parser) protected SolrDocumentreadDocument(XMLStreamReader parser) protected SolrDocumentListreadDocuments(XMLStreamReader parser) readNamedList(XMLStreamReader parser)
-
Field Details
-
XML_CONTENT_TYPE
- See Also:
-
-
Constructor Details
-
XMLResponseParser
public XMLResponseParser()
-
-
Method Details
-
getWriterType
Description copied from class:ResponseParserThe writer type placed onto the request as thewtparam.- Specified by:
getWriterTypein classResponseParser
-
getContentTypes
Description copied from class:ResponseParserA well-behaved ResponseParser will return the content-types it supports.- Specified by:
getContentTypesin classResponseParser- Returns:
- the content-type values that this parser is capable of parsing. Never null. Empty means no enforcement.
-
processResponse
-
processResponse
- Specified by:
processResponsein classResponseParser
-
readNamedList
- Throws:
XMLStreamException
-
readArray
- Throws:
XMLStreamException
-
readDocuments
- Throws:
XMLStreamException
-
readDocument
- Throws:
XMLStreamException
-
consumeRawContent
This is a stub method for handling/validating "raw" xml field values in the context of tests. Before this stub method was present, "raw" content would have still thrown an exception, albeit a different, more inscrutable exception.- Throws:
XMLStreamException
-
convertRawContent
protected static String convertRawContent(String raw, Function<XMLStreamReader, String> consumeRawContent) throws XMLStreamExceptionConvenience method that converts raw String input (should be valid xml when wrapped in a root element) and converts it to a format compatible with howXMLResponseParserparses from raw xml fields. This method is intended for test validation.The main reason this method exists is to provide a consistent way of configuring and creating and invoking the sub-parser
- Throws:
XMLStreamException
-