I'm using zBar to read QR codes from scanned image files and am trouble parsing the XML that zBar generates in my SQL scripts.
For background, zBar is an open source barcode reading tool. In addition to the source code for use in your own projects, there is a command line tool (zBarImg.exe) to read barcodes (including QR Codes) from image files. I have zBar working great so this question is specificly about how to use the XML it generates in my SQL scripts.
I'm using the ZBar command line utility (zbarimg) to read images that have two qr codes on each image and it produces this xml file:
<barcodes xmlns="http://zbar.sourceforge.net/2008/barcode"> <source href="C:\BC\SCanner\2016_03_12_14_19_44.jpg"> <index num="0"> <symbol type="QR-Code" quality="1"> <data>F01868</data> </symbol> <symbol type="QR-Code" quality="1"> <data>TC16-A397</data> </symbol> </index> </source> <source href="C:\BC\SCanner\2016_03_12_14_19_46.jpg"> <index num="0"> <symbol type="QR-Code" quality="1"> <data>F01869</data> </symbol> <symbol type="QR-Code" quality="1"> <data>TC16-A397</data> </symbol> </index> </source> <source href="C:\BC\SCanner\2016_03_12_14_19_48.jpg"> <index num="0"> <symbol type="QR-Code" quality="1"> <data>F01870</data> </symbol> <symbol type="QR-Code" quality="1"> <data>TC16-A397</data> </symbol> </index> </source> </barcodes> This works great and I can see all the information I need. For example on the first image I get the file name and the two qr codes:
<source href="C:\BC\SCanner\2016_03_12_14_19_46.jpg"> <symbol type="QR-Code" quality="1"><data>F01868</data> <symbol type="QR-Code" quality="1"><data>TC16-A397</data> I'm having trouble parsing / reading this into a usable table.
I think my problem is trying to get first an element and then nodes... but I also am confused why they the index is always zero and it just generally seems a strange way to structure the xml to me.
No comments:
Post a Comment