Package org.apache.solr.client.solrj.response

# Class XMLResponseParser

java.lang.Object
org.apache.solr.client.solrj.response.ResponseParser
org.apache.solr.client.solrj.response.XMLResponseParser

public class XMLResponseParser extends ResponseParser

Since:
  solr 1.3

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected static enum`
`XMLResponseParser.KnownType`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`XML_CONTENT_TYPE`

## Constructor Summary

Constructors
Constructor
Description
`XMLResponseParser()`

## Method Summary

Modifier and Type
Method
Description
`protected String`
`consumeRawContent(XMLStreamReader parser)`
This is a stub method for handling/validating "raw" xml field values in the context of tests.
`protected static String`
`convertRawContent(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 how `XMLResponseParser` parses from raw xml fields.
`Set<String>`
`getContentTypes()`
A well-behaved ResponseParser will return the content-types it supports.
`String`
`getWriterType()`
The writer type placed onto the request as the `wt` param.
`NamedList<Object>`
`processResponse(InputStream in, String encoding)`
`NamedList<Object>`
`processResponse(Reader in)`
`protected List<Object>`
`readArray(XMLStreamReader parser)`
`protected SolrDocument`
`readDocument(XMLStreamReader parser)`
`protected SolrDocumentList`
`readDocuments(XMLStreamReader parser)`
`protected NamedList<Object>`
`readNamedList(XMLStreamReader parser)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### XML_CONTENT_TYPE

public static final String XML_CONTENT_TYPE

See Also:
  - Constant Field Values

## Constructor Details

### XMLResponseParser

public XMLResponseParser()

## Method Details

### getWriterType

public String getWriterType()
Description copied from class: `ResponseParser`
The writer type placed onto the request as the `wt` param.

Specified by:
  `getWriterType` in class `ResponseParser`

### getContentTypes

public Set<String> getContentTypes()
Description copied from class: `ResponseParser`
A well-behaved ResponseParser will return the content-types it supports.

Specified by:
  `getContentTypes` in class `ResponseParser`
Returns:
  the content-type values that this parser is capable of parsing. Never null. Empty means no enforcement.

### processResponse

public NamedList<Object> processResponse(Reader in)

### processResponse

public NamedList<Object> processResponse(InputStream in, String encoding)

Specified by:
  `processResponse` in class `ResponseParser`

### readNamedList

protected NamedList<Object> readNamedList(XMLStreamReader parser) throws XMLStreamException

Throws:
  `XMLStreamException`

### readArray

protected List<Object> readArray(XMLStreamReader parser) throws XMLStreamException

Throws:
  `XMLStreamException`

### readDocuments

protected SolrDocumentList readDocuments(XMLStreamReader parser) throws XMLStreamException

Throws:
  `XMLStreamException`

### readDocument

protected SolrDocument readDocument(XMLStreamReader parser) throws XMLStreamException

Throws:
  `XMLStreamException`

### consumeRawContent

protected String consumeRawContent(XMLStreamReader parser) throws XMLStreamException
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 XMLStreamException
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 how `XMLResponseParser` parses 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`