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 Benjamin Kern <be...@bkern.de> on 2013/05/19 17:03:33 UTC

xPath XML-Import

Hi all,

I´m reading XML-Files into Solr. I have the following structure:

<item>

<attribute>

<name>AAAAAAAAAA</name>

<value>123456789</value>

</attribute>

<attribute>

<name>BBBBBBBBBB</name>

<value>987654321</value>

</attribute>

<attribute>

<name>CCCCCCCCCC</name>

<value>147258369</value>

</attribute>

…

</item>

 

How can I read the name with value. The Solr result should look like this.

<str name=" AAAAAAAAAA">123456789</str>

<str name=" BBBBBBBBBB">987654321</str>

<str name=" CCCCCCCCCC">147258369</str>

 

 

Any Idea?

 

Thanks

 


Re: xPath XML-Import

Posted by Erick Erickson <er...@gmail.com>.
This is really just parsing the XML using any of several parsers and
putting the results into a SolrInputDocument (assuming a SolrJ
client).

Alternatively, you could perhaps do some XSLT transformations, but I'm
not great on the ins and outs of XSLT...

Best
Erick

On Sun, May 19, 2013 at 11:03 AM, Benjamin Kern <be...@bkern.de> wrote:
> Hi all,
>
> I´m reading XML-Files into Solr. I have the following structure:
>
> <item>
>
> <attribute>
>
> <name>AAAAAAAAAA</name>
>
> <value>123456789</value>
>
> </attribute>
>
> <attribute>
>
> <name>BBBBBBBBBB</name>
>
> <value>987654321</value>
>
> </attribute>
>
> <attribute>
>
> <name>CCCCCCCCCC</name>
>
> <value>147258369</value>
>
> </attribute>
>
> …
>
> </item>
>
>
>
> How can I read the name with value. The Solr result should look like this.
>
> <str name=" AAAAAAAAAA">123456789</str>
>
> <str name=" BBBBBBBBBB">987654321</str>
>
> <str name=" CCCCCCCCCC">147258369</str>
>
>
>
>
>
> Any Idea?
>
>
>
> Thanks
>
>
>