Hi Gary,

From
http://wiki.apache.org/solr/DataImportHandler#Usage_with_XML.2BAC8-HTTP_Datasource

*It does not support namespaces , but it can handle xmls with namespaces .
When you provide the xpath, just drop the namespace and give the rest (eg
if the tag is '<dc:subject>' the mapping should just
contain 'subject').Easy, isn't it? And you didn't need to write one line of
code! Enjoy **
*
You should be able to use xpath="//titleInfo/title" without making any
modifications (removing the namespace) to your xml.

I hope that answers your question.

Regards,
Tricia

On Mon, Oct 31, 2011 at 9:24 AM, Moore, Gary <gary.mo...@ars.usda.gov>wrote:

> I'm trying to import some MODS XML using DIH.  The XML uses bound
> namespacing:
>
> <mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>      xmlns:mods="http://www.loc.gov/mods/v3";
>      xmlns:xlink="http://www.w3.org/1999/xlink";
>      xmlns="http://www.loc.gov/mods/v3";
>      xsi:schemaLocation="http://www.loc.gov/mods/v3
> http://www.loc.gov/mods/v3/mods-3-4.xsd";
>      version="3.4">
>   <mods:titleInfo>
>      <mods:title>Malus domestica: Arnold</mods:title>
>   </mods:titleInfo>
> </mods>
>
> However, XPathEntityProcessor doesn't seem to handle xpaths of the type
> xpath="//mods:titleInfo/mods:title".
>
> If I remove the namespaces from the source XML:
>
> <mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>      xmlns:mods="http://www.loc.gov/mods/v3";
>      xmlns:xlink="http://www.w3.org/1999/xlink";
>      xmlns="http://www.loc.gov/mods/v3";
>      xsi:schemaLocation="http://www.loc.gov/mods/v3
> http://www.loc.gov/mods/v3/mods-3-4.xsd";
>      version="3.4">
>   <titleInfo>
>      <title>Malus domestica: Arnold</title>
>   </titleInfo>
> </mods>
>
> then xpath="//titleInfo/title" works just fine.  Can anyone confirm that
> this is the case and, if so, recommend a solution?
> Thanks
> Gary
>
>
> Gary Moore
> Technical Lead
> LCA Digital Commons Project
> NAL/ARS/USDA
>
>

Reply via email to