You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Hazer, Bart" <Ba...@cbs.com> on 2009/02/05 20:53:34 UTC

XML response format for fields

I'm wondering why the format for fields in the XML response is like this:

 

<str name="title">Title</str>

 

Instead of this:

 

<title type="str">Title</type>

 

Is this just to allow validation of the xml?  In our system, it would be much easier to use the output in the 2nd format.  Is there an existing response writer that does this?  Or, is there a library piece of xsl that will make this transformation?

Thanks


Re: XML response format for fields

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Fri, Feb 6, 2009 at 1:23 AM, Hazer, Bart <Ba...@cbs.com> wrote:

> I'm wondering why the format for fields in the XML response is like this:
>
> <str name="title">Title</str>
>

If the node names are fixed, it is much easier to write a parser. Otherwise,
something like Solrj would not be possible because everybody has different
field names.


> Instead of this:
> <title type="str">Title</type>


Also, the field names are not limited to valid XML element names. They can
have space or ampersand characters etc.


> Is there an existing response writer that does this?  Or, is there a
> library piece of xsl that will make this transformation?


I don't think so. But there's an XsltResponseWriter to which you can specify
your own xsl.

-- 
Regards,
Shalin Shekhar Mangar.