org.apache.solr.response
Class XMLWriter

java.lang.Object
  extended by org.apache.solr.response.XMLWriter

public final class XMLWriter
extends Object

Version:
$Id: XMLWriter.java 1171741 2011-09-16 19:29:23Z hossman $

Field Summary
static float CURRENT_VERSION
           
 
Constructor Summary
XMLWriter(Writer writer, IndexSchema schema, SolrQueryRequest req, String version)
           
 
Method Summary
 int decLevel()
           
 int incLevel()
           
 void indent()
           
 void indent(int lev)
           
 int level()
           
 void setIndent(boolean doIndent)
           
 void setLevel(int level)
           
 void startTag(String tag, Map<String,String> attributes, boolean closeTag, boolean escape)
          Writes a tag with attributes
 void startTag(String tag, String name, boolean closeTag)
           
 void writeArray(String name, Iterator iter)
           
 void writeArray(String name, Object[] val)
           
 void writeAttr(String name, String val)
          Writes the XML attribute name/val.
 void writeAttr(String name, String val, boolean escape)
           
 void writeBool(String name, boolean val)
           
 void writeBool(String name, String val)
           
 void writeByte(String name, byte val)
           
 void writeByte(String name, String val)
           
 void writeCdataTag(String tag, Map<String,String> attributes, String cdata, boolean escapeCdata, boolean escapeAttr)
          Write a complete tag w/ attributes and cdata (the cdata is not enclosed in $lt;!CDATA[]!>
 void writeDate(String name, Date val)
           
 void writeDate(String name, String val)
           
 void writeDoc(String name, org.apache.lucene.document.Document doc, Set<String> returnFields, float score, boolean includeScore)
           
 void writeDocList(String name, DocList ids, Set<String> fields)
           
 void writeDouble(String name, double val)
           
 void writeDouble(String name, String val)
           
 void writeFloat(String name, float val)
           
 void writeFloat(String name, String val)
           
 void writeInt(String name, int val)
           
 void writeInt(String name, String val)
           
 void writeLong(String name, long val)
           
 void writeLong(String name, String val)
           
 void writeMap(String name, Map<Object,Object> map)
          writes a Map in the same format as a NamedList, using the stringification of the key Object when it's non-null.
 void writeNamedList(String name, org.apache.solr.common.util.NamedList val)
           
 void writeNull(String name)
           
 void writePrim(String tag, String name, String val, boolean escape)
           
static void writeResponse(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp)
           
 void writeShort(String name, short val)
           
 void writeShort(String name, String val)
           
 void writeSolrDocumentList(String name, org.apache.solr.common.SolrDocumentList docs, Set<String> fields)
           
 void writeStr(String name, String val)
           
 void writeVal(String name, Object val)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT_VERSION

public static float CURRENT_VERSION
Constructor Detail

XMLWriter

public XMLWriter(Writer writer,
                 IndexSchema schema,
                 SolrQueryRequest req,
                 String version)
Method Detail

writeResponse

public static void writeResponse(Writer writer,
                                 SolrQueryRequest req,
                                 SolrQueryResponse rsp)
                          throws IOException
Throws:
IOException

setLevel

public void setLevel(int level)

level

public int level()

incLevel

public int incLevel()

decLevel

public int decLevel()

setIndent

public void setIndent(boolean doIndent)

writeAttr

public void writeAttr(String name,
                      String val)
               throws IOException
Writes the XML attribute name/val. A null val means that the attribute is missing.

Throws:
IOException

writeAttr

public void writeAttr(String name,
                      String val,
                      boolean escape)
               throws IOException
Throws:
IOException

startTag

public void startTag(String tag,
                     Map<String,String> attributes,
                     boolean closeTag,
                     boolean escape)
              throws IOException
Writes a tag with attributes

Parameters:
tag -
attributes -
closeTag -
escape -
Throws:
IOException

writeCdataTag

public void writeCdataTag(String tag,
                          Map<String,String> attributes,
                          String cdata,
                          boolean escapeCdata,
                          boolean escapeAttr)
                   throws IOException
Write a complete tag w/ attributes and cdata (the cdata is not enclosed in $lt;!CDATA[]!>

Parameters:
tag -
attributes -
cdata -
escapeCdata -
escapeAttr -
Throws:
IOException

startTag

public void startTag(String tag,
                     String name,
                     boolean closeTag)
              throws IOException
Throws:
IOException

indent

public void indent()
            throws IOException
Throws:
IOException

indent

public void indent(int lev)
            throws IOException
Throws:
IOException

writeDoc

public final void writeDoc(String name,
                           org.apache.lucene.document.Document doc,
                           Set<String> returnFields,
                           float score,
                           boolean includeScore)
                    throws IOException
Throws:
IOException

writeSolrDocumentList

public final void writeSolrDocumentList(String name,
                                        org.apache.solr.common.SolrDocumentList docs,
                                        Set<String> fields)
                                 throws IOException
Throws:
IOException

writeDocList

public final void writeDocList(String name,
                               DocList ids,
                               Set<String> fields)
                        throws IOException
Throws:
IOException

writeVal

public void writeVal(String name,
                     Object val)
              throws IOException
Throws:
IOException

writeNamedList

public void writeNamedList(String name,
                           org.apache.solr.common.util.NamedList val)
                    throws IOException
Throws:
IOException

writeMap

public void writeMap(String name,
                     Map<Object,Object> map)
              throws IOException
writes a Map in the same format as a NamedList, using the stringification of the key Object when it's non-null.

Parameters:
name -
map -
Throws:
IOException
See Also:
Note on Returnable Data

writeArray

public void writeArray(String name,
                       Object[] val)
                throws IOException
Throws:
IOException

writeArray

public void writeArray(String name,
                       Iterator iter)
                throws IOException
Throws:
IOException

writeNull

public void writeNull(String name)
               throws IOException
Throws:
IOException

writeStr

public void writeStr(String name,
                     String val)
              throws IOException
Throws:
IOException

writeInt

public void writeInt(String name,
                     String val)
              throws IOException
Throws:
IOException

writeInt

public void writeInt(String name,
                     int val)
              throws IOException
Throws:
IOException

writeLong

public void writeLong(String name,
                      String val)
               throws IOException
Throws:
IOException

writeLong

public void writeLong(String name,
                      long val)
               throws IOException
Throws:
IOException

writeBool

public void writeBool(String name,
                      String val)
               throws IOException
Throws:
IOException

writeBool

public void writeBool(String name,
                      boolean val)
               throws IOException
Throws:
IOException

writeShort

public void writeShort(String name,
                       String val)
                throws IOException
Throws:
IOException

writeShort

public void writeShort(String name,
                       short val)
                throws IOException
Throws:
IOException

writeByte

public void writeByte(String name,
                      String val)
               throws IOException
Throws:
IOException

writeByte

public void writeByte(String name,
                      byte val)
               throws IOException
Throws:
IOException

writeFloat

public void writeFloat(String name,
                       String val)
                throws IOException
Throws:
IOException

writeFloat

public void writeFloat(String name,
                       float val)
                throws IOException
Throws:
IOException

writeDouble

public void writeDouble(String name,
                        String val)
                 throws IOException
Throws:
IOException

writeDouble

public void writeDouble(String name,
                        double val)
                 throws IOException
Throws:
IOException

writeDate

public void writeDate(String name,
                      Date val)
               throws IOException
Throws:
IOException

writeDate

public void writeDate(String name,
                      String val)
               throws IOException
Throws:
IOException

writePrim

public void writePrim(String tag,
                      String name,
                      String val,
                      boolean escape)
               throws IOException
Throws:
IOException


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.