I am performing an XQuery on a document where the values to be searched on are in the form of key/value pairs. As a simple search, I would like to return any document that has a certain value, regardless of the key. It seems to work great for some string, but not for others.
My document looks like:
<kfx:DOCUMENT ino:id=“1” xmlns:kfx=“http://www.kofax.com/dtd/” DOCID=“0000019A” DOCUMENTCLASSNAME=“DMV FORMS”>
kfx:DOCUMENTDATA
<kfx:DOCUMENTFIELD NAME=“Office Location” VALUE=“501” />
<kfx:DOCUMENTFIELD NAME=“Deposit Date” VALUE=“20030523” />
<kfx:DOCUMENTFIELD NAME=“Deposit Number” VALUE=“0026” />
<kfx:DOCUMENTFIELD NAME=“Form Type” VALUE=“Deposit Cover” />
<kfx:DOCUMENTFIELD NAME=“Batch Code” VALUE=“0000” />
<kfx:DOCUMENTFIELD NAME=“Barcode” VALUE=“501 0523030026” />
<kfx:DOCUMENTFIELD NAME=“Batch Date” VALUE=“00000000” />
<kfx:DOCUMENTFIELD NAME=“VIN” VALUE=“” />
<kfx:DOCUMENTFIELD NAME=“License” VALUE=“” />
</kfx:DOCUMENTDATA>
kfx:PRIMARYFILES
<kfx:PRIMARYFILE FILENAME=“5ac491d7-2d92-4106-95d3-733c23a379f5” NUMBER=“1” />
</kfx:PRIMARYFILES>
<kfx:SECONDARYFILES />
<kfx:OCRTEXTFILES />
</kfx:DOCUMENT>
My XQuery is:
declare namespace kfx=‘http://www.kofax.com/dtd/’
for $q in input()/kfx:XMLRELEASE//kfx:DOCUMENT
where $q/kfx:DOCUMENTDATA/kfx:DOCUMENTFIELD[@VALUE=“Deposit Cover”]
return $q
This XQuery returns the expected document, however if I try to search with the VALUE set to “501 0523030026”, I get no documents returned.
Any ideas??
Thanks!
Michelle
Hi Michelle,
I just tried both queries with Tamino 4.1.4.3, by placing the document into ino:etc.
Both queries worked okay.
Perhaps there is something specific to your Tamino version, or the schema you are using?
Greetings,
Trevor.
I’m using Tamino 4.1.4.1 and I’ve attached my schemas and sample XML. Any ideas?
schemas.zip (3.43 KB)
Hi Michelle,
in the file K006A001.xml there is this line:
<kfx:DOCUMENTFIELD NAME="Barcode" VALUE="501 0523030026 " />
Please note that there is a space here ----------------^</pre><BR>If the filter condition contains a space, the XQuery works:<BR><pre class="ip-ubbcode-code-pre"> declare namespace kfx="http://www.kofax.com/dtd/"
for $q in input()/kfx:XMLRELEASE//kfx:DOCUMENT
where $q/kfx:DOCUMENTDATA/kfx:DOCUMENTFIELD[@VALUE="501 0523030026 "]
return $q
I hope that helps,
Trevor.
Thanks Trevor, that was the problem. I hadn’t noticed the extra space.