You can configure the XML content indexing using these options:
Create a custom XML document filter to handle your XML format.
Create an XSL style sheet that transforms your XML format into the Sybase Search import XML format.
Use the default XML document filter.
Repurpose your XML data into the import XML format such that XML document filter handles XML content automatically.
Devoloping
a custom XSL style sheet
Identify the XML content for indexing. This example indexes the BookReviews.xml file having id, isbn, author, title, and
reviewer searchable as metadata, and reviewtext searchable as text.
<BookReviews> <Review id="44399"> <Book isbn="1401302718"> <Title>The Rest of Her Life</Title> <Author>Moriarty, Laura</Author> <Price>$24.95</Price> </Book> <Reviewer>Castellitto, Linda</Reviewer> <ReviewText> Like her 2005 debut novel ... </ReviewText> </Review> <Review id="11200"> <Book isbn="1400063566"> <Title>Away</Title> <Author>Bloom, Amy</Author> <Price>$23.95</Price> </Book> <Reviewer>McKanic, Arlene</Reviewer> <ReviewText> Lillian Leyb, the heroine ... </ReviewText> </Review> </BookReviews>
Develop a custom XSL style sheet. This example reformats BookReviews.xml file into Sybase Search import XML format:
<xsl:template match="BookReviews"> <Import xmlns="urn:schemas-sybase-com/sysearch-import"> <xsl:for-each select="Review"> <Document> <Metadata> <Entry> <Name>id</Name> <Value><xsl:value-of select="@id"/></Value> </Entry> <Entry> <Name>isbn</Name> <Value><xsl:value-of select="Book/@isbn"/></Value> </Entry> <Entry> <Name>title</Name> <Value><xsl:value-of select="Book/Title"/></Value> </Entry> <Entry> <Name>author</Name> <Value><xsl:value-of select="Book/Author"/></Value> </Entry> <Entry> <Name>price</Name> <Value><xsl:value-of select="Book/Price"/></Value> </Entry> <Entry> <Name>reviewer</Name> <Value><xsl:value-of select="Reviewer"/></Value> </Entry> </Metadata> <Content> <xsl:value-of select="ReviewText"/> </Content> </Document> </xsl:for-each>
Edit the DocumentFilters.xml file located in install_location\OmniQ\config\DocumentFilters.xml. Add a new entry under the document filter class com.omniq.flt.xml.XMLInputMatchingFilter. The purpose of com.omniq.flt.xml.RootElementMatcher class is to inform the root class to apply transformation action to XML files with a root element of BookReviews.
<InputMatcher class="com.omniq.flt.xml.RootElementMatcher"> <Pattern>BookReviews</Pattern> <Action type="transform"> <Params> <Param> <Name>StylesheetURL</Name> <Value>file:/D:\XML\transform\BookReviews.xsl</Value> </Param> </Params> </Action> </InputMatcher>
This process transforms the XML content into a format that Sybase Search ImportXML filter can read and index.