LoadXMLSettings
Overview
int STLoadXMLSettings (void *hBarcode, char *filePath, int silent)
hBarcode is a handle to a barcode session.
filePath is the path of the XML file to load.
silent controls whether the function writes to standard output
or displays a message box (win32).
Load settings from the specified XML file. This method can also be used to define sets of properties to be applied sequentially to an image until a barcode is located. It's also possible to specify properties that only apply to particular pages of an image. The silent parameter controls whether message message boxes will be displayed if there is a parsing error. If silent is non zero then no messages will be displayed.
The simplest format for the xml is as follows:
<xml>
<SoftekBarcode>
<Properties>
<PropertyName>PropertyValue</PropertyName>
</Properties>
</SoftekBarcode>
</xml>
Example:
Set MedianFilter to 1 (True) and set ReadCode25 to 0 (False).
<xml>
<SoftekBarcode>
<Properties>
<MedianFilter>1</MedianFilter>
<ReadCode25>0</ReadCode25>
</Properties>
</SoftekBarcode>
</xml>
The xml file can also be used to apply sets of properties sequentially to an image until a barcode is found:
This example first applies default values to an image. If no barcode is found then a MedianFilter is applied.
<xml>
<SoftekBarcode>
<Properties>
</Properties>
<Properties>
<MedianFilter>1</MedianFilter>
</Properties>
</SoftekBarcode>
</xml>
This example restricts the search to the first 3 pages of an image, until a barcode is located:
<xml>
<SoftekBarcode>
<Properties>
<PageNo>1</PageNo>
</Properties>
<Properties>
<PageNo>2</PageNo>
</Properties>
<Properties>
<PageNo>3</PageNo>
</Properties>
</SoftekBarcode>
</xml>
The default set of properties is as follows:
<xml version='1.0' encoding='iso-8859-1'> <SoftekBarcode> <Properties> <AllowDuplicateValues>1</AllowDuplicateValues> <Code39Checksum>0</Code39Checksum> <Code39NeedStartStop>1</Code39NeedStartStop> <ColorThreshold>0</ColorThreshold> <ConvertUPCEToEAN13>1</ConvertUPCEToEAN13> <Despeckle>0</Despeckle> <ErrorCorrection>0</ErrorCorrection> <ExtendedCode39>0</ExtendedCode39> <LineJump>1</LineJump> <MaxLength>999</MaxLength> <MedianFilter>0</MedianFilter> <MinSeparation>180</MinSeparation> <MinLength>4</MinLength> <MinOccurrence>2</MinOccurrence> <MinSpaceBarWidth>1</MinSpaceBarWidth> <MultipleRead>0</MultipleRead> <NoiseReduction>0</NoiseReduction> <Pattern></Pattern> <PageNo>0</PageNo> <PrefOccurrence>5</PrefOccurrence> <QuietZoneSize>0</QuietZoneSize> <ReadCodabar>1</ReadCodabar> <ReadCode128>1</ReadCode128> <ReadCode25ni>0</ReadCode25ni> <ReadCode25>1</ReadCode25> <ReadCode39>1</ReadCode39> <ReadEAN13>1</ReadEAN13> <ReadNumeric>0</ReadNumeric> <ReadPatchCodes>0</ReadPatchCodes> <ReadPDF417>1</ReadPDF417> <ReadUPCA>0</ReadUPCA> <ReadUPCE>1</ReadUPCE> <ScanDirection>15</ScanDirection> <SkewTolerance>0</SkewTolerance> <ShowCheckDigit>0</ShowCheckDigit> <UseOverSampling>0</UseOverSampling> </Properties> </SoftekBarcode> </xml>Return Value
1 on success and 0 on failure.