Use a fielddatasource for reading field from database and then use
xpathentityprocessor .Field datasource will give you the stream that is
needed by xpathentity processor.Bellow is the example dih configuration
code.

<?xml version="1.0"?>
<dataConfig>
  <dataSource type="JdbcDataSource" 
  driver="oracle.jdbc.driver.OracleDriver" 
  url="jdbc:oracle:thin:@localhost:1521:xe" 
  user="user" 
  password="password"
  name="ds"/>
  <dataSource name="fieldSource" type="FieldReaderDataSource" />
  <document>
    <entity name="clobxml" dataSource="ds" query="select * from tableXX"
transformer="ClobTransformer">
      <field column="ID" name="id" />
      <field column="SUPPLIER_APPROVALS" name="supplier_approvals"
clob="true"/>
            <entity name="xmlread" dataSource="fieldSource"
processor="XPathEntityProcessor" forEach="/suppliers/supplier"
dataField="clobxml.SUPPLIER_APPROVALS" onError="continue" >
              <field column="supplier_name" xpath="/suppliers/supplier/name"
/>
              <field column="supplier_id" xpath="/suppliers/supplier/id" />
            </entity>
    </entity>
  </document>
</dataConfig>
 

-----
Thanx:
Grijesh
http://lucidimagination.com
-- 
View this message in context: 
http://lucene.472066.n3.nabble.com/How-to-use-XML-parser-in-DIH-for-a-database-tp2508015p2515910.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to